Pilihan Editor
OPEN-SOURCE SCRIPT
Telah dikemas kini

Half Causal Estimator

996
Overview

The Half Causal Estimator is a specialized filtering method that provides responsive averages of market variables (volume, true range, or price change) with significantly reduced time delay compared to traditional moving averages. It employs a hybrid approach that leverages both historical data and time-of-day patterns to create a timely representation of market activity while maintaining smooth output.

Core Concept

Traditional moving averages suffer from time lag, which can delay signals and reduce their effectiveness for real-time decision making. The Half Causal Estimator addresses this limitation by using a non-causal filtering method that incorporates recent historical data (the causal component) alongside expected future behavior based on time-of-day patterns (the non-causal component).

This dual approach allows the filter to respond more quickly to changing market conditions while maintaining smoothness. The name "Half Causal" refers to this hybrid methodology—half of the data window comes from actual historical observations, while the other half is derived from time-of-day patterns observed over multiple days. By incorporating these "future" values from past patterns, the estimator can reduce the inherent lag present in traditional moving averages.

How It Works

The indicator operates through several coordinated steps. First, it stores and organizes market data by specific times of day (minutes/hours). Then it builds a profile of typical behavior for each time period. For calculations, it creates a filtering window where half consists of recent actual data and half consists of expected future values based on historical time-of-day patterns. Finally, it applies a kernel-based smoothing function to weight the values in this composite window.

This approach is particularly effective because market variables like volume, true range, and price changes tend to follow recognizable intraday patterns (they are positive values without DC components). By leveraging these patterns, the indicator doesn't try to predict future values in the traditional sense, but rather incorporates the average historical behavior at those future times into the current estimate.

The benefit of using this "average future data" approach is that it counteracts the lag inherent in traditional moving averages. In a standard moving average, recent price action is underweighted because older data points hold equal influence. By incorporating time-of-day averages for future periods, the Half Causal Estimator essentially shifts the center of the filter window closer to the current bar, resulting in more timely outputs while maintaining smoothing benefits.

Understanding Kernel Smoothing

At the heart of the Half Causal Estimator is kernel smoothing, a statistical technique that creates weighted averages where points closer to the center receive higher weights. This approach offers several advantages over simple moving averages. Unlike simple moving averages that weight all points equally, kernel smoothing applies a mathematically defined weight distribution. The weighting function helps minimize the impact of outliers and random fluctuations. Additionally, by adjusting the kernel width parameter, users can fine-tune the balance between responsiveness and smoothness.

The indicator supports three kernel types. The Gaussian kernel uses a bell-shaped distribution that weights central points heavily while still considering distant points. The Epanechnikov kernel employs a parabolic function that provides efficient noise reduction with a finite support range. The Triangular kernel applies a linear weighting that decreases uniformly from center to edges. These kernel functions provide the mathematical foundation for how the filter processes the combined window of past and "future" data points.

Applicable Data Sources

The indicator can be applied to three different data sources: volume (the trading volume of the security), true range (expressed as a percentage, measuring volatility), and change (the absolute percentage change from one closing price to the next).

Each of these variables shares the characteristic of being consistently positive and exhibiting cyclical intraday patterns, making them ideal candidates for this filtering approach.

Practical Applications

The Half Causal Estimator excels in scenarios where timely information is crucial. It helps in identifying volume climaxes or diminishing volume trends earlier than conventional indicators. It can detect changes in volatility patterns with reduced lag. The indicator is also useful for recognizing shifts in price momentum before they become obvious in price action, and providing smoother data for algorithmic trading systems that require reduced noise without sacrificing timeliness.

When volatility or volume spikes occur, conventional moving averages typically lag behind, potentially causing missed opportunities or delayed responses. The Half Causal Estimator produces signals that align more closely with actual market turns.

Technical Implementation

The implementation of the Half Causal Estimator involves several technical components working together. Data collection and organization is the first step—the indicator maintains a data structure that organizes market data by specific times of day. This creates a historical record of how volume, true range, or price change typically behaves at each minute/hour of the trading day.

For each calculation, the indicator constructs a composite window consisting of recent actual data points from the current session (the causal half) and historical averages for upcoming time periods from previous sessions (the non-causal half). The selected kernel function is then applied to this composite window, creating a weighted average where points closer to the center receive higher weights according to the mathematical properties of the chosen kernel. Finally, the kernel weights are normalized to ensure the output maintains proper scaling regardless of the kernel type or width parameter.

This framework enables the indicator to leverage the predictable time-of-day components in market data without trying to predict specific future values. Instead, it uses average historical patterns to reduce lag while maintaining the statistical benefits of smoothing techniques.

Configuration Options

The indicator provides several customization options. The data period setting determines the number of days of observations to store (0 uses all available data). Filter length controls the number of historical data points for the filter (total window size is length × 2 - 1). Filter width adjusts the width of the kernel function. Users can also select between Gaussian, Epanechnikov, and Triangular kernel functions, and customize visual settings such as colors and line width.

These parameters allow for fine-tuning the balance between responsiveness and smoothness based on individual trading preferences and the specific characteristics of the traded instrument.

Limitations

The indicator requires minute-based intraday timeframes, securities with volume data (when using volume as the source), and sufficient historical data to establish time-of-day patterns.

Conclusion

The Half Causal Estimator represents an innovative approach to technical analysis that addresses one of the fundamental limitations of traditional indicators: time lag. By incorporating time-of-day patterns into its calculations, it provides a more timely representation of market variables while maintaining the noise-reduction benefits of smoothing. This makes it a valuable tool for traders who need to make decisions based on real-time information about volume, volatility, or price changes.
Nota Keluaran
New Feature: Selectable Weighting Schemes for Confidence Compensation

The Half Causal Estimator now includes configurable weighting modes that determine how the estimator handles confidence imbalances between real-time data (causal) and pseudo-future estimates (non-causal). This allows for greater control over how the filter adapts to uncertain or inconsistent time-of-day patterns.

What’s New:
You can now choose between three weighting schemes:

Symmetric (Default)
  • If the future estimate (non-causal side) shows low confidence (based on Coefficient of Variation), its influence is reduced.
  • The lost weight is symmetrically transferred to the real-time causal data on the other side of the filter window.
  • Balances the filter around the center using a confidence-driven see-saw approach.


Linear
  • Applies a direct linear boost to the causal side based on the lack of confidence in the non-causal side.


None
  • Applies the filter without adjusting for confidence.
  • Useful as a baseline or when no compensation is needed.


This enhancement adds a layer of adaptive intelligence to the estimator, letting you choose how aggressively the filter responds to uncertain future behavior.

Nota Keluaran
Forgot to remove a reference sma. Renamed one of the plots.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.