ATR indicator
Author: MrIzzy
Creation Date: 4/11/2010 12:53 PM
profile picture

MrIzzy

#1
Hi There,

I am plotting an ATR indicator on AAPL - daily charts. Not sure I understand the results. To illustrate, I set the length to 2. This is what I get:

Date = 4/1/2010 12:00:00 AM High = 238.73 Low = 232.75 Close = 235.97 ATR = 4.65
Date = 4/5/2010 12:00:00 AM High = 238.51 Low = 234.77 Close = 238.49 ATR = 4.19
Date = 4/6/2010 12:00:00 AM High = 240.24 Low = 237 Close = 239.54 ATR = 3.72
Date = 4/7/2010 12:00:00 AM High = 241.92 Low = 238.6601 Close = 240.6 ATR = 3.49
Date = 4/8/2010 12:00:00 AM High = 241.54 Low = 238.04 Close = 239.95 ATR = 3.49
Date = 4/9/2010 12:00:00 AM High = 241.89 Low = 240.46 Close = 241.79 ATR = 2.72


The way I learned ATR is to define:
TH = TrueHigh = max(High[Bar],Close[Bar-1])
TL = TrueLow = min(Low[Bar],Close[Bar-1])
TR = TrueRange = TrueHigh-TrueLow

ATR = AverageTrueRange is the arithmetic average of the last severeal (in our case 2) TrueRange results. Here is what I have:

Date = 4/1/10 High=238.73 Low=232.75 Close=235.97 TH, TL, TR=238.73 232.75 5.98 MyAtr=4.06
Date = 4/5/10 High=238.51 Low=234.77 Close=238.49 TH, TL, TR=238.51 234.77 3.74 MyAtr=4.86
Date = 4/6/10 High=240.24 Low=237.00 Close=239.54 TH, TL, TR=240.24 237.00 3.24 MyAtr=3.49
Date = 4/7/10 High=241.92 Low=238.66 Close=240.60 TH, TL, TR=241.92 238.66 3.26 MyAtr=3.25
Date = 4/8/10 High=241.54 Low=238.04 Close=239.95 TH, TL, TR=241.54 238.04 3.50 MyAtr=3.38
Date = 4/9/10 High=241.89 Low=240.46 Close=241.79 TH, TL, TR=241.89 239.95 1.94 MyAtr=2.72

On 4/8/10, the TR was 3.26 and 3.50 so the ATR should be (3.26+3.50)/2 = 3.38

Why does WL give an ATR of 3.49 for 4/8/10 ? Is WL using some other avareging process. If so, please write the exact formula that it is using.

Thank you in advance,
Izzy

profile picture

Eugene

#2
QUOTE:
ATR = AverageTrueRange is the arithmetic average

No, it's not.

Average True Range is calculated by applying Wilder's Moving Average to True Range. WilderMA (not to be confused with WMA) is an EMA with half number of periods.

Click on the links that point to the Wealth-Lab Wiki (or click "More info..." on an indicator in the Indicators list.)
profile picture

MrIzzy

#3
Many thanks - that is a big help.

It now turns out that it is difficult to use ATR becuase of faulty data. As an example, please look at BRFS (BRF-Brazil Foods S.A. Daily). The bar on 8/28/2009 looks very funny. The Low seem "out of whack" which might mess ATR based strategies.

Instead, I am thinking of using just the Close which seems to be "cleaner". Is there a simple way to define Historical Volatility?

By "Historical Volatility" I mean the Standard Deviation of returns.
Return = (Close[Bar]-Close[Bar-1])/Close[Bar-1]


Standard Deviation is defined here:
http://en.wikipedia.org/wiki/Standard_deviation

Is there a WL function to calculate this? If not - I could write it from "scratch".
profile picture

Eugene

#4
QUOTE:
please look at BRFS

Which data provider? If it's Fidelity, then you need to report Fidelity data issues to Fidelity.
QUOTE:
The bar on 8/28/2009 looks very funny.

btw, you can detect all kinds of funny bars with the built-in strategy "Bad History Data Check".
QUOTE:
Is there a WL function to calculate this?

Yes, it does - HV. See the complete list of standard indicators in the Wealth-Lab Wiki: Standard Indicators. Same for TASC Indicators and Community.Indicators. Also, you can see the list of installed indicators right in your Indicators list.
profile picture

MrIzzy

#5
Thanks, Eugene
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).