MA Candles Supertrend Strategy
Feb 2, 2021

The MA Candles Supertrend Strategy indicator utilizes moving average-based price values to construct specialized candles, upon which a Supertrend calculation is applied to identify trend reversals and potential trade entries. By smoothing the Open, High, Low, and Close data before applying trend-following logic, the tool aims to reduce market noise and provide more stable signal generation.
Usage
This script is designed for trend-following strategies. It generates buy and sell signals based on the crossover of the Supertrend component derived from moving average candles, while also filtering signals through a higher-timeframe condition.
- Bullish Signals: A long entry is triggered when the Supertrend turns bullish (dir == 1) and the price meets the yearly high-low condition, suggesting a sustained upward momentum.
- Bearish Signals: A short entry is triggered when the Supertrend turns bearish (dir == -1) and the price meets the yearly low-high condition.
- Exits: Positions are closed when the trend direction reverses or when specific price thresholds relative to the trailing stop are breached.
Details
The strategy operates through a three-step process:
- MA Candle Construction: Instead of standard price action, the script calculates a chosen Moving Average (SMA, EMA, HMA, etc.) for each OHLC component. These "smoothed" candles serve as the primary data source.
- Supertrend Derivative: A Supertrend calculation is applied directly to these smoothed MA candles. This calculation uses an ATR-based trailing stop to determine the current trend direction.
- Yearly Filter: To ensure trades align with longer-term trends, the script references yearly high and low ranges. This prevents entering longs when the price is significantly overextended or entering shorts when the price is in a deep recovery zone, depending on the threshold settings.
Settings
Moving Average Settings
- Moving Average Type: Selection for the smoothing method of the price candles (EMA, SMA, HMA, RMA, VWMA, WMA).
- Loopback Bars: The length used for the primary candle smoothing moving average.
Supertrend Settings
- ATR Moving Average Type: The MA type used specifically for the Average True Range calculation.
- ATR Length: The lookback period for the ATR component of the Supertrend.
- ATR Multiplier: The factor by which the ATR is multiplied to set the distance of the trailing stop.
- Use Wicks: Determines whether candle wicks are factored into the Supertrend stop calculation.
Strategy & Filter Settings
- Thresholds (dThreshold/rThreshold): Adjusts the sensitivity of the yearly high/low trend filter.
- Trade Direction: Filter to allow only Long, only Short, or All trades.
- Time Period: Input for the start and end date for backtesting purposes.
FAQ
How do I use the MA Candles Supertrend Strategy?
You can use the signals generated on the chart (labeled Long/Short) to identify trend entries and the trailing stop line to manage exits and stop-loss levels.
What is the advantage of using MA candles over standard candles?
MA candles filter out minor price fluctuations and "noise," allowing the Supertrend logic to focus on the underlying trend momentum rather than being prematurely triggered by high volatility.
How can I access this tool?
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.