Supertrend Multi Time Frame - Auto HTF calculation
Mar 5, 2019

The Supertrend Multi Time Frame - Auto HTF indicator provides a dual-layer trend analysis by plotting both the standard Supertrend for the current timeframe and an automatically calculated higher timeframe (HTF) version to identify market direction and potential reversals.
Usage
The indicator can be used to identify trend alignment between two different time horizons. When both the current timeframe Supertrend and the HTF Supertrend signal the same direction, the indicator colors the price bars to signify high-conviction trend periods.
- Lime/Green Bars: Occur when both the current and HTF Supertrend indicators signal an uptrend.
- Red Bars: Occur when both the current and HTF Supertrend indicators signal a downtrend.
- Default/White Bars: Appear when there is a divergence between the two timeframes, suggesting a counter-trend move or a period of consolidation.
Traders can use the HTF Supertrend (thicker line) as the primary trend filter and the current timeframe Supertrend (thinner line) for entry signals or trailing stop-loss management.
Details
The script features an automated HTF selection logic that eliminates the need for manual adjustment when switching chart periods. The selection logic is as follows:
- 1m chart -> 5m HTF
- 3m/5m chart -> 15m HTF
- 15m/30m/45m chart -> 60m HTF
- 1h/2h/3h chart -> 4h HTF
- 4h chart -> Daily HTF
- Daily chart -> Weekly HTF
The HTF Supertrend is calculated using the request.security function with lookahead_on to ensure the trailing levels align correctly with the historical context of the higher period.
Settings
- Multiplier: Adjusts the ATR multiplier for the Supertrend calculation. A higher value makes the indicator less sensitive to price fluctuations.
- Period: Sets the ATR length used to calculate the volatility component of the Supertrend.
- Change Bar Color: A toggle to enable or disable the trend-based bar coloring on the chart.
FAQ
How do I interpret the different line thicknesses? The thinner line represents the Supertrend for your current chart timeframe, while the thicker line represents the automatically calculated Higher Time Frame (HTF) Supertrend.
Can I change the HTF period manually? This specific version is designed with an "Auto HTF" calculation logic that shifts based on your current chart period to ensure a consistent top-down perspective.
How can I access this indicator? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
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.