All indicators

Simple Moving Average - ATR Trailing Stop

Jan 22, 2020

Static chart image
SignalsMoving AveragesTrailing-StopVolatility

The Simple Moving Average - ATR Trailing Stop indicator provides a dynamic risk management level by calculating a volatility-adjusted offset from a moving average to help traders secure profits and define exit points.

Usage

The Usage section describes how the script can be used to manage trades and identify trend shifts. The indicator plots a step-line that acts as a trailing stop loss or take profit level based on the relationship between price and a Simple Moving Average (SMA).

  • Long Positions: When the price is trading above the SMA, the trailing stop is plotted below the moving average (SMA - [ATR * Multiplier]). This serves as a dynamic floor to protect gains during an uptrend.
  • Short Positions: When the price is trading below the SMA, the trailing stop is plotted above the moving average (SMA + [ATR * Multiplier]). This serves as a dynamic ceiling during a downtrend.
  • Trend Reversals: A change in the position of the step-line relative to the price indicates a potential trend shift. The script includes built-in alerts for when the price crosses over or under the SMA, signaling these bullish or bearish transitions.

Details

The script combines two fundamental technical analysis concepts: trend following and volatility measurement. By using the Simple Moving Average (SMA) as a baseline, the script identifies the primary direction of the market. To account for market "noise" and price fluctuations, it incorporates the Average True Range (ATR).

The trailing stop level is calculated by multiplying the current ATR by a user-defined value and adding or subtracting that result from the SMA. The step-line visual style is utilized to provide clear, horizontal levels that are easier to track for manual order placement compared to a standard smoothing line.

Settings

  • Source: Determines the price data used to calculate the moving average (e.g., Close, Open, High, Low).
  • Moving Average Period: Sets the lookback length for the Simple Moving Average calculation.
  • ATR Period: Sets the lookback period for the Average True Range to determine current market volatility.
  • ATR Multiplier: Adjusts the distance of the trailing stop from the moving average. A higher multiplier provides more room for price fluctuations, while a lower multiplier creates a tighter stop.

FAQ

How does the ATR Multiplier affect the indicator? A higher multiplier increases the distance between the moving average and the trailing stop, which can help avoid premature exits during volatile markets. A lower multiplier keeps the stop closer to the price action for tighter risk control.

Can this indicator be used for entries? While primarily designed for exits and risk management, traders often use the crossover of the price and the SMA (which triggers the stop-line flip) as a signal for potential trend entries.

How do I access the Simple Moving Average - ATR Trailing Stop? 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.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

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