BullsEdges algo trading guide: The Average True Range measures how much a market typically moves. Learn how ATR works and how to use it for stops, targets, filters and position sizing.
The Average True Range (ATR), introduced by J. Welles Wilder, does not tell you direction. It tells you how much a market is moving. That makes it one of the most practical tools in algorithmic trading.
BullsEdges algo trading application: Match the ATR calculation across research and execution platforms before using it to size stops or compare results.
How it works
For each bar, the True Range is the largest of:
- high minus low,
- the distance from the previous close to the high,
- the distance from the previous close to the low.
This includes gaps between bars. ATR is the average of the true range over a period, usually 14 bars.
One practical detail: different platforms average differently. Wilder's original uses a smoothed average; MetaTrader 5's built-in ATR uses a simple moving average of the true range. If you compare a Python backtest with an MT5 EA, use the same method or the values - and the trades - will differ.
Uses in trading systems
1. Stop distances
A stop of 1.5-2.5 x ATR places the stop outside normal noise and adapts automatically to volatility.
2. Targets
Targets can also be set in ATR multiples, for example 2 x ATR. This keeps the risk-reward structure consistent across quiet and busy periods.
3. Position sizing
Because the stop is in ATR, the lot size calculated from the risk percentage automatically shrinks in volatile markets and grows in quiet ones.
4. Trailing stops
A "chandelier" style trailing stop sits a few ATR below the highest high since entry. It gives trends room to breathe.
5. Volatility filters
- Skip trades when ATR is very low (no movement to profit from).
- Skip or reduce size when ATR is extremely high (news, panic).
6. Comparing markets
ATR as a percentage of price lets you compare volatility between gold, currency pairs and indices.
Choosing the timeframe and period
Use ATR from the timeframe you trade on. A 14-period ATR on M5 describes very different movement from a 14-period ATR on H4. Longer periods are smoother but slower to react to a volatility change.
Limitations
- ATR lags. A sudden spike will not show up fully until several bars later.
- It measures size, not direction. High ATR can mean a strong trend or a chaotic range.
BullsEdges takeaway for algo trading
ATR turns "the market is busy" into a number you can use. Use it to set stops and targets that fit current conditions, and to size positions so that the money at risk stays constant.
Trading forex and gold carries a high level of risk and may not be suitable for every investor. Past performance and backtests do not guarantee future results. This article is education, not financial advice.
