How it works
An ATR trailing stop turns a volatility measure into an exit rule. The problem it solves is universal: a stop placed at a fixed dollar or percentage distance is arbitrary, and the same distance that is comfortable in a quiet market is triggered by a single ordinary bar once volatility doubles. Anchoring the distance to average true range makes the stop breathe with the market, so the amount of noise it tolerates stays roughly constant in the market's own terms.
The essential mechanic is the ratchet. For a long position the stop is placed a multiple of ATR below a running reference, usually the highest close or highest high since entry, and crucially it is only ever allowed to move up. If price pulls back, the raw calculation would place the stop lower, but the plotted stop holds its level. That one-way movement is what makes the tool a trailing stop rather than a band: it locks in progress and never gives back ground it has already taken.
How the multiple is chosen is the whole design decision. A tight multiple around 1.5 exits quickly, produces many small losses and captures only the cleanest part of a move. A wide multiple around 3.5 gives a trend room to breathe but returns a large share of the open profit at the end. There is no correct answer, only a trade-off between win rate and average win that must be matched to the holding horizon: a swing trader and a multi-month trend follower will pick very different numbers and both can be right.
Several well-known indicators are packaged versions of this same idea. The Chandelier Exit hangs the stop a multiple of ATR below the highest high of a fixed lookback. Supertrend, the study shown on the chart here, computes bands around the midpoint of each bar at a multiple of ATR and flips between them with the same ratcheting logic, which is why it draws as a single line that switches sides. They differ in their reference point and their flip rules, but all of them are the same construction: a volatility-scaled distance that only tightens.
Calculation
The arithmetic in words, in the order it happens.
Compute average true range over N periods, conventionally 14 or 22, using Wilder smoothing. Choose a multiplier M, conventionally between 2 and 3. For a long position the raw stop level is the reference price minus M times ATR, where the reference is normally the highest close or highest high since the position was opened. The plotted stop is the running maximum of that raw level, so it can rise but never fall; for a short the mirror applies and the stop is a running minimum. When price closes through the stop the position is considered exited and, in indicators that flip rather than exit, the calculation restarts from the opposite side. The Chandelier Exit variant sets the reference to the highest high of the last 22 bars and uses a multiplier of 3; the Supertrend variant centres its bands on the average of the high and the low and applies the same ratchet.
Source
An AlgoBeamScript implementation of the formula above, written by us from the arithmetic so the code and the calculation agree line for line.
Runs unchanged on the platform and in the AlgoBeamTS runtime. The language reference is in the documentation.
Inputs
Defaults are the values most charting packages ship with. They are conventions, not optimal settings — the right length depends on your instrument and your holding period.
| Input | Default | What it changes |
|---|---|---|
| ATR length | 14 | Bars in the true range average. Short lengths let the stop tighten quickly when the market calms down; long lengths hold a wider stop through a volatility spike and are usually preferable for position trades. |
| Multiplier | 3.0 | How many ATR the stop sits from the reference. This single number governs the trade-off between being stopped out early and giving back open profit at the end of a move. |
| Reference price | Highest high since entry | What the stop trails from. Using highest close rather than highest high ignores intrabar spikes and produces a slightly tighter, less spike-sensitive stop. |
| Trigger basis | Close | Whether the stop is hit intrabar or only on a close beyond it. Close-only triggering avoids being taken out by wicks but exposes the position to a much larger single-bar loss. |
How to read it
What practitioners take from the plot. Read these as descriptions of market state, not as entry signals.
- Stop rising steadily beneath price
- A trend in good order. The distance between price and the stop is roughly the amount of open profit currently at risk.
- Stop flat while price pulls back
- The ratchet is holding. The pullback is inside normal volatility and no action is required unless the level is breached.
- Distance from price to stop widening sharply
- ATR has expanded. Risk per unit has grown even though nothing was traded, which is a reason to reduce size rather than to widen tolerance.
- Close through the stop
- The move has broken by the volatility standard chosen. Whether this is a reversal or a shakeout is unknowable in advance, which is precisely why the rule is mechanical.
Limitations
Where this indicator misleads. None of these are fixed by a better parameter.
- ATR expands only after volatility arrives, so the stop set before a shock is calibrated for the calm that preceded it and the realised loss can exceed the planned one substantially.
- By design it gives back a portion of every winning trade, since the stop must sit a full multiple of ATR below the peak. Trailing stops improve consistency and reduce average profit at the same time.
- In a choppy range the stop is hit repeatedly with no trend to pay for the losses, which is the standard failure mode of every trend-following exit.
- A gap through the level fills far beyond it. The stop defines where you intended to exit, never where you will actually be filled.
Educational reference. This page explains how an indicator is built and how it is commonly read. It is not investment advice, not a recommendation and not a signal service. No indicator is profitable on its own — each is a way of describing a market, and any rule built on one has to be tested with realistic costs before it is traded.