All indicators

ATR Trailing Stop (Long or Short Selectable)

Nov 27, 2025

Static chart image
Trailing-StopVolatility

The ATR Trailing Stop (Long or Short Selectable) indicator provides a dynamic risk management tool that calculates a protective trailing stop-loss starting from a specific user-defined date and price level.

Usage

The Usage section describes how the script can be used to manage risk for both long and short positions. Users typically apply this indicator once a breakout occurs or a specific price target is met to lock in profits or define an initial protective stop.

Entry Management

Users can specify the exact date the trade was initiated. If the "Entry Price" setting is left at 0, the script defaults to the closing price of that day. Alternatively, users can input a custom entry price, such as a pattern boundary or a volume-weighted average price (VWAP) from an intraday scaling tactic.

Stop-Loss Logic

The indicator uses the Average True Range (ATR) to determine the distance of the stop-loss from the price. For long positions, the stop-loss trails the highest price reached, moving only upwards. For short positions, the stop-loss trails the lowest price reached, moving only downwards. If the price crosses the trailing stop level, the calculation stops, signaling an exit.

Details

The script is constructed to offer flexibility between initial risk and ongoing trend following. It differentiates between the "Entry Day" and subsequent days to allow for tighter initial risk management.

The core logic follows these steps:

  1. Activation: The script remains inactive until the specified Entry Year, Month, and Day are reached.
  2. Initial Calculation: On the first bar of the trade, the script uses a "First-Day Custom Multiplier" to set the initial protective stop.
  3. Trailing Phase: From the second bar onwards, the script calculates the stop-loss using the standard ATR Multiplier.
  4. Ratchet Mechanism: The stop-loss is designed to be "non-repainting" and unidirectional; it can only move in favor of the trade (up for longs, down for shorts) to ensure gains are protected.

Settings

General Settings

  • Trade Direction: Select between "Long" or "Short" setups to determine if the stop is placed below or above the price.
  • Entry Year/Month/Day: Sets the start date for the stop-loss calculation.
  • Entry Price: The price level used for the initial stop calculation. Use 0 to default to the Entry Day's close.

ATR Settings

  • ATR Period: The lookback period used to calculate the Average True Range (e.g., 14 for standard daily volatility).
  • ATR Multiplier: The constant used to determine the distance of the stop-loss from the peak (or trough) price during the trailing phase.
  • First-Day Custom Multiplier: A specific multiplier used only on the entry day, allowing for a tighter or wider initial risk compared to the standard trailing phase.

FAQ

How do I adjust the sensitivity of the trailing stop? You can adjust the sensitivity by changing the ATR Multiplier; a lower multiplier (e.g., 1.5) creates a tighter stop, while a higher multiplier (e.g., 3.0) allows for more price fluctuation.

Can I use this for intraday trading? Yes, while the inputs ask for Year/Month/Day, the script will begin its calculation on the first available bar of that specified date on any timeframe.

How do I get access to the ATR Trailing Stop (Long or Short Selectable)? 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.