Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Compairision of 2 ATR's Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
freetroy
Posted : Wednesday, October 12, 2011 10:51:25 AM
Registered User
Joined: 1/3/2005
Posts: 9

I was looking over this article - http://adamhgrimes.com/blog/2011/10/12/volatility-compression/
and wanted to turn it into an indicator.

The concept is to " shows the ratio of the 5 day to 60 day ATR, with a reference line at 1.0".  OI want to use different numbers so here is the Realcode I tried:

'# ATR = indicator.Library.Average True Range
'Plot = ATR(5) / ATR(50)

It does not match the chart.  How can I change the time frame the ATR uses to get this to work, they both seem to be stuck on 14.

Thanks in advance - troy

Bruce_L
Posted : Wednesday, October 12, 2011 10:57:10 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
Something like the following should work:

RealCode for Real People: Indicators

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:ATR Ratio
'|******************************************************************
'# ATR1 = indicator.Library.Average True Range
'# ATR2 = indicator.Library.Average True Range
Plot = ATR1.Value / ATR2.Value

You would need to Edit the Indicator after it is created to adjust the Periods. Just right-click on the indicator and select Edit (not Edit RealCode).

You could also just add two ATRs to the chart and then drag and drop them onto each and select Plot Comparison | Ratio.

Comparison Plots

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
freetroy
Posted : Wednesday, October 12, 2011 11:28:54 AM
Registered User
Joined: 1/3/2005
Posts: 9
Thanks for the quick response!  I put this in and it came very close.  The problem is when I go in to adjust the ATR settings there are three choices.  I have tried all the combinations with a 0 in each field and can not get it to match.  Any idea what that three "period" is coming from?
Bruce_L
Posted : Wednesday, October 12, 2011 11:45:58 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I cannot reproduce this. When I copy and paste the RealCode into StockFinder, I only get two Period settings. I do not know where the third Period setting would be coming from.

I would try creating the indicator from scratch by just copying the RealCode from the forums and pasting it directly to the charts. This should create the indicator without requiring you to open the RealCode Editor.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
freetroy
Posted : Wednesday, October 12, 2011 1:20:18 PM
Registered User
Joined: 1/3/2005
Posts: 9

First off - Bruce you are the best.  Everytime I ask a question here, which is not often, you are always on the ball.  Great work!

I can reproduce the chart in excel but when i took your advice and just put it on the chart the number are off by just a bit - any idea what might cause this?

Bruce_L
Posted : Wednesday, October 12, 2011 1:23:07 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
How is the spreadsheet calculating Average True Range? Does it use Simple Moving Averages, Exponential Moving Averages, Wilder's Smoothing or something else? How much data does the spreadsheet use to calculate Average True Range?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
freetroy
Posted : Wednesday, October 12, 2011 3:32:42 PM
Registered User
Joined: 1/3/2005
Posts: 9
simple MA of the "true Range" - 400 days off data
Bruce_L
Posted : Wednesday, October 12, 2011 3:37:39 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
The ATR built into StockFinder is Wilder's Smoothed. If you set the Period of the ATR to 1 in the following RealCode Indicator, it should match a ratio calculated using Simple Moving Averages of True Range:

'|******************************************************************
'|*** StockFinder RealCode Indicator - Version 5.0 www.worden.com
'|*** Copy and paste this header and code into StockFinder *********
'|*** Indicator:Simple ATR Ratio
'|******************************************************************
'# ATR = indicator.Library.Average True Range
Plot = ATR.AVG(5) / ATR.AVG(50)

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
freetroy
Posted : Monday, October 17, 2011 4:26:49 PM
Registered User
Joined: 1/3/2005
Posts: 9
Thanks again for your help Bruce!
Bruce_L
Posted : Monday, October 17, 2011 4:27:25 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You're welcome.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.