ATR Stop - Classic w/SignalsATR Stop – Classic w/ Signals
A clean implementation of a traditional ATR-based trailing stop with optional buy/sell signals and customizable label styling.
This indicator plots a dynamic stop line derived from the Average True Range (ATR). The stop trails price in trending conditions and flips direction when price crosses the stop level. When a flip occurs, the script generates BUY and SELL signals and plots labels directly near the ATR stop line.
How It Works
The stop is calculated using the standard ATR trailing stop method:
Long Stop:
Close − (ATR × Multiplier)
Short Stop:
Close + (ATR × Multiplier)
The script maintains a directional state:
When price closes above the stop, the indicator switches to long mode.
When price closes below the stop, it switches to short mode.
The stop then trails price using the maximum/minimum of previous stop values to prevent the stop from moving against the active trend.
Signals
Signals occur when price crosses the ATR stop:
BUY: Close crosses above the stop
SELL: Close crosses below the stop
Labels are plotted close to the ATR line to visually align the signal with the trailing stop.
Optional non-repainting confirmation allows signals to appear only after the bar closes.
Features
Classic ATR trailing stop logic
BUY/SELL signal labels
Optional non-repainting signals (close confirmation)
Optional bar coloring based on trend direction
Customizable label colors and text color
ATR stop plotted using circle style for clear visibility
Labels positioned relative to the ATR stop line
Inputs
ATR Period
Length used to calculate the Average True Range.
Multiplier
Controls the distance of the stop from price. Higher values produce wider stops.
Barcolor
Optionally colors price bars based on trend direction.
Non-Repainting Signals
If enabled, signals are confirmed only after the bar closes.
Label Style
BUY Color
SELL Color
Text Color
Typical Use
This type of ATR stop is commonly used for:
Trend-following systems
Dynamic trailing stops
Breakout confirmation
Trade management
The indicator helps visualize trend direction while providing a simple signal when price crosses the trailing stop.
Pine Script® indicator






















