I'm seeing websites computing ATR% with (ATR / close) * 100
, and I believe this yields unintuitive results.
Let's take the popular ADR indicator as a simpler example. Its absolute value, without accounting for the averaging, is the distance between high and low high - low
. Its relative value, used for computing the ADR% indicator popularized by Kristjan Kullamägi, is (high / low - 1.0) * 100.0
, which essentially represents how stretched a candle is.
If we were to apply the relative formula recommended for the ATR% to compute our ADR%, we'd get (high - low) / close * 100.0
. This represents an awkward distance between the high and low relative to the candle's close. For two candles having the same height, their ADR% could vastly differ depending depending on where the close is located within that candle's range. This isn't really what we want, is it?
Now, the same logic can be applied to computing the ATR%.
First, the official absolute formula used for computing the true range is max(high - low, abs(high - prev_close), abs(low - prev_close))
, but it can be simplified to max(high, prev_close) - min(low, prev_close)
.
From there, the relative formula becomes max(high, prev_close) / min(low, prev_close)
. This handles the 3 use cases where:
prev_close > high > low
resolves toprev_close / low
.high > prev_close > low
resolves tohigh / low
.high > low > prev_close
resolves tohigh / prev_close
.
How does this look like in practice? Let's compare the recommended formula (in red) against ours (in green).
Wild differences, right? The formulas match up when the close is near the low however, when it's not, the red formula fails to capture some moves and even diverges from what we'd expect.
There's more! When we plot the formula for the relative daily range in black, we can see that our formula yields similar results when there is no gap, as we'd intuitively expect.
Finally, the complete ATR% formula is rma(max(high, prev_close) / min(low, prev_close), length)
.