Kalman Hull Supertrend
Apr 1, 2024

The Kalman Hull Supertrend indicator provides an adaptive trend-following system that combines the noise-reduction capabilities of a Kalman filter with the responsiveness of a Hull Moving Average (HMA) to drive a Supertrend calculation. By replacing the standard price source and internal averages with a Kalman-filtered HMA, the tool offers a smoother yet more reactive approach to trend identification compared to traditional methods.
Usage
The Usage section focuses on how the adaptive trend signals can be integrated into a trading strategy.
- Trend Identification: The primary output is a Supertrend line that changes color based on the prevailing market direction. A green line indicates a bullish trend, while a red line indicates a bearish trend.
- Signal Generation: The script plots "𝕃" (Long) and "𝕊" (Short) labels when the trend direction shifts. These are generated based on the crossover of price and the Kalman-filtered adaptive bands.
- Visual Confirmation: Users can enable candle painting to color the chart bars according to the detected trend, helping to maintain directional bias during high-volatility periods.
- Entry/Exit: Traders often use the color changes as entry triggers or the Supertrend line itself as a dynamic trailing stop-loss level.
Details
The Kalman Hull Supertrend is constructed using a multi-layered filtering approach:
- Kalman Filter: An algorithm used to estimate the state of a system by filtering out "noise" from the data. In this script, it is applied to the raw price source to create a predictive, smoothed base.
- Kalman Hull Moving Average (KHMA): The standard HMA uses Weighted Moving Averages (WMA). This script replaces the WMA components with the Kalman Filter. The calculation involves taking the Kalman filter of the data set, doubling it, and subtracting the Kalman filter of the full period, followed by another Kalman filter application over the square root of the period length.
- Supertrend Integration: Instead of using the typical
(high + low) / 2as the source, the Supertrend formula uses the KHMA. This makes the resulting bands significantly more adaptive to recent price action while maintaining a smooth trajectory.
Settings
Calculation
- Kalman Price Source: Determines the input data used for the initial Kalman filtering (e.g., Close, HL2).
- Measurement Noise: Controls the sensitivity of the Kalman Filter. Higher values result in more smoothing, while lower values make the filter more reactive to price changes.
- Process Noise: Affects how quickly the filter adapts to changes in the underlying trend.
Supertrend
- ATR Period: Sets the lookback period for the Average True Range used to calculate the band distance.
- Factor: A multiplier for the ATR that determines how far the Supertrend bands are placed from the price source.
UI Settings
- Show Supertrend on chart?: Toggles the visibility of the Supertrend line.
- Paint candles according to Trend?: Toggles bar coloring based on the current trend direction.
- Show Long and Short Signals: Toggles the display of the 𝕃 and 𝕊 labels.
- Long/Short Color: Customizes the colors used for bullish and bearish trend elements.
FAQ
How do I access Kalman Hull Supertrend?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
What makes this different from a normal Supertrend?
Standard Supertrends use simple price averages and can be prone to lag or whipsaws. This version uses a Kalman Filtered Hull Moving Average as the source, which reduces lag while simultaneously filtering out market noise.
Can I use this for scalping or day trading?
Yes, because the Kalman Filter is highly adaptive to recent price action, it is effective on lower timeframes for capturing intraday trend shifts with reduced signal delay.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.