All indicators

SuperTrend Long Strategy +TrendFilter

May 4, 2023

Static chart image
Support and ResistanceSignalsMoving AveragesVolatility

The SuperTrend Long Strategy +TrendFilter indicator is a comprehensive trading tool designed to identify long opportunities by combining the classic SuperTrend logic with an integrated moving average trend filter.

Usage

The SuperTrend Long Strategy +TrendFilter is primarily used to capture trend reversals while ensuring entries align with the broader market direction.

  • Entry Signals: A "Buy" signal is generated when the SuperTrend shifts from a bearish to a bullish state (price closes above the upper band) provided that the closing price is also above the Moving Average filter.
  • Trend Identification: Users can utilize the built-in highlighter and bar coloring features to instantly identify the current market bias.
  • Filtering: The Moving Average filter acts as a validator, reducing whipsaws in sideways markets by only allowing long entries when the price is trading above the specified average.

Details

The script calculates dynamic support and resistance levels using the Average True Range (ATR) multiplied by a user-defined factor. It offers two distinct methods for ATR calculation: the standard ta.atr() function or a Simple Moving Average (SMA) of the True Range.

The core logic tracks the trend variable, switching between 1 (Uptrend) and -1 (Downtrend) based on price action relative to the calculated bands. The addition of the trend filter ensures that even if the SuperTrend flips bullish, the strategy remains cautious unless the Moving Average confirms the trend.

Settings

SuperTrend Settings

  • ATR Period: Sets the lookback period for ATR calculation. Higher values result in smoother, slower-reacting bands.
  • ATR Multiplier: Determines the distance of the bands from the price source.
  • Source: Defines the price input for band calculations (default is HL2).
  • Change ATR Calculation Method?: Toggles between using the standard ATR formula or an SMA of the True Range.

Filter Settings

  • Moving Average Period: Sets the length for the trend-filtering moving average.
  • Moving Average Source: Defines the price input for the filter (default is Close).

Visuals & Strategy

  • Show Buy/Sell Signals?: Enables or disables the visibility of signal labels on the chart.
  • Highlighter On/Off?: Toggles the background shading between the price and the SuperTrend line.
  • Bar Coloring On/Off?: Enables price bars to be colored based on the active trend.
  • Date Range (From/To): Allows users to define the specific time window for backtesting the strategy.

FAQ

How do I access SuperTrend Long Strategy +TrendFilter?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Can I use this for short positions?

While the script is named as a "Long Strategy," the logic includes sell signals to close long positions and enter short trades, which can be visualized on the chart.

What timeframe works best?

The script is versatile; however, its effectiveness depends on the ATR settings. Shorter ATR periods are generally better for lower timeframes, while longer periods suit daily or weekly charts.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.