Red CandleTrading Journal
Gold (XAUUSD)

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.

True range and ATR(14) on XAUUSD H1 candles: a gap candle whose true range of 15.36 is measured from the previous close, next to ATR(14) for 15M, 1H and 4H

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:

  1. High − Low of the current candle
  2. |High − previous Close|
  3. |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.

#TimeHighLowCloseH−L|H−Cp||L−Cp|TR
008:002651.332648.952649.022.38–––
108:152651.402648.742650.192.662.380.282.66
208:302653.232648.842651.084.393.041.354.39
308:452653.152650.162651.902.992.070.922.99
409:002654.392649.342651.395.052.492.565.05
509:152653.272650.342651.652.931.881.052.93
609:302654.772650.162652.254.613.121.494.61
709:452654.132650.932651.743.201.881.323.20
810:002652.232649.882650.872.350.491.862.35
910:152646.972644.052645.692.923.906.826.82
1010:302646.612644.632645.211.980.921.061.98
1110:452646.652643.672643.672.981.441.542.98
1211:002644.652641.442642.633.210.982.233.21
1311:152643.582640.852641.092.730.951.782.73
1411:302641.662638.072640.583.590.573.023.59
1511:452642.442639.012639.013.431.861.573.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.

#TimeHighLowCloseTR
008:002673.792663.442670.59–
109:002678.832670.602677.398.24
210:002680.232672.582678.627.65
311:002685.232678.342681.856.89
412:002682.912674.032674.038.88
513:002677.892673.462677.524.43
614:002680.262673.172677.367.09
715:002688.132676.762683.7611.37
816:002690.822680.492689.1110.33
917:002675.912673.752673.7515.36
1018:002678.092672.162676.355.93
1119:002681.162676.612680.524.81
1220:002682.682673.482673.489.20
1321:002682.122669.512675.1412.61
1422:002679.792668.752668.7511.04
1523:002670.092660.902665.289.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

#TimeHighLowCloseTR
0Mon 00:002667.692657.182663.27–
1Mon 04:002664.862649.552649.5515.31
2Mon 08:002662.302648.862655.1013.44
3Mon 12:002680.252653.292668.4626.96
4Mon 16:002674.562645.472667.1229.09
5Mon 20:002672.332641.652663.7430.68
6Tue 00:002672.722640.132665.8532.59
7Tue 04:002677.312652.052660.0825.26
8Tue 08:002668.452653.792655.5014.66
9Tue 12:002697.642686.702693.2042.14
10Tue 16:002696.962679.172679.1717.79
11Tue 20:002701.052679.392696.6921.88
12Wed 00:002701.372685.562685.5615.81
13Wed 04:002698.232671.012685.8627.22
14Wed 08:002687.792667.202667.2020.59
15Wed 12:002674.892660.942672.4613.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

TimeframeCandlesTime coveredATR(14)1.5 × ATR
15M153.5 hours3.545.31
1H1514 hours8.8513.28
4H1556 hours23.8235.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 App

Continue in the docs

Similar Patterns →Import candles →
ⓘ Educational content, not financial advice. Trading involves risk, and past results don't guarantee future results.
#atr#average true range#atr calculation#true range#volatility#xauusd#stop loss

About the author

Sukma Saputra builds and runs Red Candle, a desktop trading journal for forex and gold traders that keeps your charts, checklist and results on your own computer.

Support →

Related articles