Average True Range: Dynamic Stop Loss Levels

Average True Range (ATR) helps express a stop distance in terms of recent volatility. The important decision is how that distance updates after entry. An ATR calculation can change every bar while a stop stays fixed, moves only in a favorable direction, or widens the trade’s risk. Those behaviors are not interchangeable.
Use LuxAlgo’s native charts to examine price movement and Quant to build and test the complete rule. This guide explains the calculation, smoothing choices, position sizing, and stop-update decisions that make a dynamic exit reproducible.
How to Calculate ATR
True Range is the largest of three values: the current high minus low, the absolute difference between the current high and previous close, and the absolute difference between the current low and previous close. ATR smooths that series over a chosen period.
ATR measures movement, not direction. It can rise during a rally, a selloff, or a volatile range. A high reading does not establish a trend or predict the next move. TradingView’s ATR documentation describes the calculation and its selectable smoothing methods.
Periods Are Bars, Not Always Days
A 14-period ATR uses 14 bars of the selected timeframe. On an hourly chart those are hourly bars; on a daily chart they are daily bars. Five, 21, 63, and 252 daily bars are rough stock-market trading-calendar approximations for a week, month, quarter, and year. They are not exact calendar conversions or universal counts for markets that trade every day.
SMA, Wilder Smoothing, and EMA
A simple moving average gives equal weight to each observation in its window. A 20-bar SMA gives each of those 20 true-range values 5% weight. Wilder smoothing instead updates recursively, using a coefficient of 1 divided by the length. A conventional EMA uses 2 divided by length plus 1.
At length 20, those update coefficients are 0.05 and approximately 0.0952. The EMA therefore puts more weight on the newest observation, but “twice as fast” is not an exact universal description of the resulting stop behavior. Initialization, prior values, and the exit rule also matter. Record the smoothing method whenever you compare results.
Set the Initial Stop Distance
Distance = reference ATR × multiplier. Subtract the distance from a long entry or add it to a short entry. Specify which ATR observation is available at entry, such as the last completed bar.
| Hypothetical entry | ATR and multiplier | Initial stop |
|---|---|---|
| Long at $100 | $2 × 2 = $4 | $96 |
| Short at $100 | $2 × 2 = $4 | $104 |
| Long EUR/USD at 1.1000 | 50 pips × 2.5 = 125 pips | 1.0875, using a 0.0001 pip |
These are calculation examples, not recommended settings. Day, swing, and position trading do not each have a universally correct multiplier. The entry rule, timeframe, instrument, holding period, and costs all affect the choice. Test a limited range and examine nearby values rather than relying on the best historical result.
Choose What “Dynamic” Means
Define one of these approaches before entering the trade:
- Fixed at entry: calculate the initial ATR distance once and leave the stop unchanged unless another explicit exit rule applies.
- Recalculated from entry: recompute the distance using current ATR. This can widen risk when volatility increases.
- Trailing reference: calculate a candidate stop from a defined price reference, such as the highest high since entry for a long position.
- One-way ratchet: allow a long stop to rise but never fall, or a short stop to fall but never rise.
A trailing calculation and a one-way ratchet are separate instructions. For a long position, a ratchet can retain the higher of the previous stop and the new candidate. For a short position, it can retain the lower. Specify update timing, including whether the strategy waits for the bar to close.
A Worked Trailing-Stop Example
Suppose a long position enters at $100 with ATR of $2 and a 2× multiplier. Its initial stop is $96. Later, the highest high since entry reaches $108 while ATR remains $2. The candidate stop becomes $104: $108 minus $4.
If ATR rises to $3 with no new high, the same calculation returns $102. A one-way ratchet keeps the previous $104 stop. A calculation without that constraint may lower it to $102, giving back more of the favorable move. Neither method guarantees the actual execution price.
Likewise, increasing the multiplier from 2× to 2.5× or 3× after reaching a profit milestone does not automatically lock in more profit. The result depends on the reference price and existing stop. If R represents the original planned monetary risk, define both the milestone and the subsequent update rule explicitly.
ATR Settings Across Markets
Shorter lookbacks generally respond more strongly to recent changes; longer lookbacks smooth them more. Neither is automatically better for a particular trading style. A slower estimate may lag a sudden jump, while a faster estimate may react heavily to an isolated large bar.
Absolute ATR values are expressed in the instrument’s price units. A $5 ATR on a $500 stock and a $5 ATR on a $20 stock describe very different relative movement. For comparisons, a clearly defined percentage measure such as ATR divided by price times 100 can provide context, while contract size and currency still matter for monetary risk.
A rise in volatility does not require widening every existing stop. Consider the strategy’s planned exposure, its exit rule, and whether new entries should be restricted. Changing the multiplier or lookback during a losing trade is a strategy change that deserves testing, not a neutral adjustment.
Size the Position From the Planned Risk
For a simple stock position, divide the planned monetary loss allowance by the estimated loss per share, including the stop distance and an allowance for costs. Round down to the permitted quantity. For contracts, incorporate the monetary point or pip value and account-currency conversion. The CME position-sizing lesson explains why quantity and stop distance must be considered together.
A hypothetical $50,000 account with a $500 allowance, ATR of $2.50, and a 2× multiplier gives a $5 stop distance and 100 shares before costs. If estimated round-trip costs and execution allowance are $0.25 per share, 95 shares use $498.75 of that allowance. Also check the purchase price or margin required.
Keeping the same quantity while doubling the stop distance roughly doubles the planned stop loss before costs. Keeping the allowance constant instead requires approximately halving the quantity before entry. Neither calculation guarantees a maximum realized loss: the SEC’s stop-order bulletin explains the difference between a trigger price and an execution price.
Test Dynamic Exits With LuxAlgo Quant

In Quant, describe the entry, ATR calculation, initial stop, update reference, ratchet, and sizing rule. Use the Code, Review, and Run workflow to inspect the implementation and evaluate it. A successful run shows that the code executes; it does not establish that the strategy matches your intention or will be profitable.
- Set consistent assumptions. Review inputs and properties, including capital, order size, commissions, and slippage. Percentage order allocation is different from stop-based account risk.
- Inspect actual simulated trades. Check when entries occur, which ATR values are used, and whether the stop ever moves in an unintended direction.
- Compare one change at a time. Keep the same entries and data when comparing a fixed stop with an ATR-based alternative. Record net results, drawdown, and trade count.
- Evaluate unseen data. Reserve a period not used for tuning and test nearby settings. An isolated strong result is weak evidence of robustness.
Combining ATR with a moving average, price level, or trendline creates another hypothesis to test. There is no universal 32% drawdown reduction or 15% performance improvement from an ATR stop or indicator combination. Keep claims tied to the specific data and rules that produced them.
Native strategy testing does not automatically place or manage broker orders. Validate any execution workflow separately. Use LuxAlgo Journal to review supported trading records and notes alongside the original plan.
Video: Setting Stops With ATR
The Trading Journal tutorial illustrates ATR stop placement. Evaluate its examples within a complete strategy, including sizing, costs, and the stop’s update rules.
FAQs
How do I choose the right ATR multiplier for my trading strategy and market conditions?
Test a limited range with your specific entry rule, timeframe, instrument, and costs. Compare nearby settings and evaluate unseen data. A wider distance increases planned loss per unit, so review position size as well.
What are the benefits of using ATR-based stop-losses instead of fixed stop-loss levels?
ATR provides a consistent way to express distance relative to recent volatility. Whether this improves results depends on the strategy. A stop calculated from ATR can remain fixed at entry or update under explicit rules; it does not automatically reduce losses or smooth returns.
How does the selected ATR period influence how quickly stop-loss levels adapt to market volatility?
Shorter periods generally react more strongly to recent changes, while longer periods smooth them more. The smoothing method also matters. The stop only changes if its update rule uses the new ATR value, so define that behavior separately from the indicator period.
Read next