In the ATR definition in WikiLab
ATR = ( Previous ATR * ( n - 1 ) + TR ) / n
the starting value, namely the 'Previous ATR' of the first bar of the period, is not given.
I have found 2 definitions:
(1) 'High - Low' of first bar (Alexander Elder)
(2) Mean TR of all bars of the period (from Wikipedia)
Which one is used by WL6?
Size:
Color:
QUOTE:
the starting value, namely the 'Previous ATR' of the first bar of the period, is not given.
The starting value of the previous ATR is the
WilderMA of the
TrueRange. Sounds exactly like Wikipedia because Wealth-Lab uses original definition by J. Welles Wilder.
Size:
Color:
I also think it's like this.
WilderMA also depends on previous WilderMA, and again, also the WilderMA definition in WL Wiki is incomplete because it lacks the starting value of 'previous WilderMA'.
As WilderMA is the exponential moving average of the true ranges (with a constant of 1/n instead of 2/n or 2/(n+1)), we know that the starting value for the EMA is the SMA of the true ranges. This is because the EMA is defined like this.
When calculating this SMA we see that the true range of the first bar in the period does not exist because it uses the close of the zeroth bar, which in general does not exist.We need a definition that holds for any case.
So one suggestion would be to use the simple day's range of the first bar when calculating the SMA of the true ranges, i.e. High - Low of the first bar, as the true range of the first bar.
Could you verify this?
Size:
Color:
In accordance with the documentation, the first period's true range may be undefined. In this case, High[0] - Low[0] is used.
Size:
Color:
Thank you.
Size:
Color: