How to calculate ATR, with 15M, 1H and 4H examples
Calculate the Average True Range step by step: true range, the first ATR(14) and Wilder smoothing, simulated on 15M, 1H and 4H XAUUSD candles.

ATR (Average True Range) measures how far price usually moves in one candle. It averages the true range of the last 14 candles, so an ATR(14) of 8.85 on XAUUSD H1 means one hourly candle has recently covered about $8.85 from its high to its low, including gaps.
ATR does not show direction. It only measures how much the market is moving, which makes it useful for sizing stop losses and comparing calm and busy periods.
Step 1: the true range of each candle
The true range (TR) is the largest of three distances:
- High − Low of the current candle
- |High − previous Close|
- |Low − previous Close|
The second and third distances catch gaps. If price closes at 2650.87 and the next candle trades between 2644.05 and 2646.97, the candle itself is only 2.92 tall, but price actually moved 6.82 from the previous close. TR counts the 6.82.
Because TR needs the previous close, you need 15 candles to get 14 true ranges.
Step 2: the first ATR
The first ATR(14) is the simple average of the first 14 true ranges:
ATR = (TR₁ + TR₂ + … + TR₁₄) ÷ 14
Step 3: Wilder smoothing for every next candle
After the first value, each new ATR keeps 13/14 of the old one and adds 1/14 of the new true range:
ATR now = (ATR before × 13 + TR now) ÷ 14
This is J. Welles Wilder's original method. One unusual candle moves ATR only a little, and its effect fades gradually.
Simulation: XAUUSD 15M
The candles below are illustrative numbers, not real prices. Candle 0 only supplies the previous close.
| # | Time | High | Low | Close | H−L | |H−Cp| | |L−Cp| | TR |
|---|---|---|---|---|---|---|---|---|
| 0 | 08:00 | 2651.33 | 2648.95 | 2649.02 | 2.38 | – | – | – |
| 1 | 08:15 | 2651.40 | 2648.74 | 2650.19 | 2.66 | 2.38 | 0.28 | 2.66 |
| 2 | 08:30 | 2653.23 | 2648.84 | 2651.08 | 4.39 | 3.04 | 1.35 | 4.39 |
| 3 | 08:45 | 2653.15 | 2650.16 | 2651.90 | 2.99 | 2.07 | 0.92 | 2.99 |
| 4 | 09:00 | 2654.39 | 2649.34 | 2651.39 | 5.05 | 2.49 | 2.56 | 5.05 |
| 5 | 09:15 | 2653.27 | 2650.34 | 2651.65 | 2.93 | 1.88 | 1.05 | 2.93 |
| 6 | 09:30 | 2654.77 | 2650.16 | 2652.25 | 4.61 | 3.12 | 1.49 | 4.61 |
| 7 | 09:45 | 2654.13 | 2650.93 | 2651.74 | 3.20 | 1.88 | 1.32 | 3.20 |
| 8 | 10:00 | 2652.23 | 2649.88 | 2650.87 | 2.35 | 0.49 | 1.86 | 2.35 |
| 9 | 10:15 | 2646.97 | 2644.05 | 2645.69 | 2.92 | 3.90 | 6.82 | 6.82 |
| 10 | 10:30 | 2646.61 | 2644.63 | 2645.21 | 1.98 | 0.92 | 1.06 | 1.98 |
| 11 | 10:45 | 2646.65 | 2643.67 | 2643.67 | 2.98 | 1.44 | 1.54 | 2.98 |
| 12 | 11:00 | 2644.65 | 2641.44 | 2642.63 | 3.21 | 0.98 | 2.23 | 3.21 |
| 13 | 11:15 | 2643.58 | 2640.85 | 2641.09 | 2.73 | 0.95 | 1.78 | 2.73 |
| 14 | 11:30 | 2641.66 | 2638.07 | 2640.58 | 3.59 | 0.57 | 3.02 | 3.59 |
| 15 | 11:45 | 2642.44 | 2639.01 | 2639.01 | 3.43 | 1.86 | 1.57 | 3.43 |
Cp is the previous candle's close. In candle 9, price gapped down, so TR comes from the low and the previous close (6.82), not from the candle's own height (2.92).
- Sum of TR 1–14 = 49.49
- First ATR(14) = 49.49 ÷ 14 = 3.535 ≈ 3.54
- Candle 15: (3.535 × 13 + 3.43) ÷ 14 = 3.53
ATR(14) on 15M covers 14 × 15 minutes = 3.5 hours of trading.
Simulation: XAUUSD 1H
The method is the same. The table shows only the true range; candle 9 is again a gap.
| # | Time | High | Low | Close | TR |
|---|---|---|---|---|---|
| 0 | 08:00 | 2673.79 | 2663.44 | 2670.59 | – |
| 1 | 09:00 | 2678.83 | 2670.60 | 2677.39 | 8.24 |
| 2 | 10:00 | 2680.23 | 2672.58 | 2678.62 | 7.65 |
| 3 | 11:00 | 2685.23 | 2678.34 | 2681.85 | 6.89 |
| 4 | 12:00 | 2682.91 | 2674.03 | 2674.03 | 8.88 |
| 5 | 13:00 | 2677.89 | 2673.46 | 2677.52 | 4.43 |
| 6 | 14:00 | 2680.26 | 2673.17 | 2677.36 | 7.09 |
| 7 | 15:00 | 2688.13 | 2676.76 | 2683.76 | 11.37 |
| 8 | 16:00 | 2690.82 | 2680.49 | 2689.11 | 10.33 |
| 9 | 17:00 | 2675.91 | 2673.75 | 2673.75 | 15.36 |
| 10 | 18:00 | 2678.09 | 2672.16 | 2676.35 | 5.93 |
| 11 | 19:00 | 2681.16 | 2676.61 | 2680.52 | 4.81 |
| 12 | 20:00 | 2682.68 | 2673.48 | 2673.48 | 9.20 |
| 13 | 21:00 | 2682.12 | 2669.51 | 2675.14 | 12.61 |
| 14 | 22:00 | 2679.79 | 2668.75 | 2668.75 | 11.04 |
| 15 | 23:00 | 2670.09 | 2660.90 | 2665.28 | 9.19 |
- Sum of TR 1–14 = 123.83
- First ATR(14) = 123.83 ÷ 14 = 8.845 ≈ 8.85
- Candle 15: (8.845 × 13 + 9.19) ÷ 14 = 8.87
ATR(14) on 1H covers 14 hours, a little more than one trading session.
Simulation: XAUUSD 4H
| # | Time | High | Low | Close | TR |
|---|---|---|---|---|---|
| 0 | Mon 00:00 | 2667.69 | 2657.18 | 2663.27 | – |
| 1 | Mon 04:00 | 2664.86 | 2649.55 | 2649.55 | 15.31 |
| 2 | Mon 08:00 | 2662.30 | 2648.86 | 2655.10 | 13.44 |
| 3 | Mon 12:00 | 2680.25 | 2653.29 | 2668.46 | 26.96 |
| 4 | Mon 16:00 | 2674.56 | 2645.47 | 2667.12 | 29.09 |
| 5 | Mon 20:00 | 2672.33 | 2641.65 | 2663.74 | 30.68 |
| 6 | Tue 00:00 | 2672.72 | 2640.13 | 2665.85 | 32.59 |
| 7 | Tue 04:00 | 2677.31 | 2652.05 | 2660.08 | 25.26 |
| 8 | Tue 08:00 | 2668.45 | 2653.79 | 2655.50 | 14.66 |
| 9 | Tue 12:00 | 2697.64 | 2686.70 | 2693.20 | 42.14 |
| 10 | Tue 16:00 | 2696.96 | 2679.17 | 2679.17 | 17.79 |
| 11 | Tue 20:00 | 2701.05 | 2679.39 | 2696.69 | 21.88 |
| 12 | Wed 00:00 | 2701.37 | 2685.56 | 2685.56 | 15.81 |
| 13 | Wed 04:00 | 2698.23 | 2671.01 | 2685.86 | 27.22 |
| 14 | Wed 08:00 | 2687.79 | 2667.20 | 2667.20 | 20.59 |
| 15 | Wed 12:00 | 2674.89 | 2660.94 | 2672.46 | 13.95 |
- Sum of TR 1–14 = 333.42
- First ATR(14) = 333.42 ÷ 14 = 23.82
- Candle 15: (23.816 × 13 + 13.95) ÷ 14 = 23.11
Candle 15 is calmer than the average, so ATR drops. ATR(14) on 4H covers 56 hours, about two and a half trading days.
Comparing the three timeframes
| Timeframe | Candles | Time covered | ATR(14) | 1.5 × ATR |
|---|---|---|---|---|
| 15M | 15 | 3.5 hours | 3.54 | 5.31 |
| 1H | 15 | 14 hours | 8.85 | 13.28 |
| 4H | 15 | 56 hours | 23.82 | 35.73 |
A 1H candle is four times longer than a 15M candle, but in this example its ATR is only about 2.5 times larger. Ranges usually grow more slowly than time, because price often moves back and forth within a longer candle.
The 1.5 × ATR column shows one common way traders use ATR: a stop loss placed 1.5 ATR away, so normal candle noise is less likely to hit it. The multiplier is a choice, not a rule. Record it in your journal and review whether it suits your setups.
Using ATR for position size
With a stop distance from ATR, you can size the position so the risk stays fixed. On XAUUSD, one standard lot is usually 100 ounces, so a $1 move is $100 per lot (check your broker's contract size).
Example on 1H: you risk $100 and your stop is 13.28 away.
Lots = $100 ÷ (13.28 × $100) = 0.075, rounded down to 0.07 lot.
On 4H, the same $100 risk with a 35.73 stop gives 0.02 lot. A wider stop means a smaller position for the same risk.
Why your platform may show a slightly different number
- MetaTrader 5's built-in Average True Range indicator uses a simple 14-candle average of true range, not Wilder smoothing. The values are close but not identical.
- Wilder smoothing (used by many charting platforms) needs a run-in period. With only 15 candles the value is still settling, so calculate from a few hundred candles when you compare.
- Broker data differs. Server time, session hours and price feed all change the candles, and with them the true range.
ATR in Red Candle
Similar Patterns measures every move in ATR with Wilder smoothing (ATR(14) is the standard setting, and AI Analysis always uses it), so a move of "+1.2 ATR(14)" means 1.2 normal candle ranges at that moment. This lets the app compare a quiet year with a volatile one, or gold with a currency pair. See Similar Patterns and the guide on how to use Similar Patterns.
Key takeaways
- True range is the largest of High − Low, |High − previous Close| and |Low − previous Close|, so gaps count.
- ATR(14) needs 15 candles: the first value is the average of 14 true ranges.
- After that, ATR now = (ATR before × 13 + TR now) ÷ 14.
- ATR(14) covers 3.5 hours on 15M, 14 hours on 1H and 56 hours on 4H.
- ATR measures movement, not direction. Use it to size stops and positions, and record your multiplier in your journal.
Try it in Red Candle
Keep your checklist, daily limits and trading journal together on your computer.
Download AppContinue in the docs
Similar Patterns →Import candles →ⓘ Educational content, not financial advice. Trading involves risk, and past results don't guarantee future results.
Related articles
How to Use Similar Patterns the Right Way
Set up Similar Patterns in Red Candle, choose settings that fit how you trade, and read matches, outcomes and drawdown without overreading them.
Read article →XAUUSD across the Asia, London and New York sessions
How gold usually behaves in the Asia, London and New York sessions, what tends to change between them, and how to record your trades by session.
Read article →Win rate vs. risk:reward: which number matters more?
A 40% win rate can make money and a 70% win rate can lose it. Learn how win rate and risk:reward work together, with break-even figures.
Read article →