|
BDJ
 Member
 Posts: 35
Joined: 5/15/2008
User Profile |
Hello all,
Is it possible to calculate the ATR on a specific symbol (not the symbol being analyzed) in Omni Language (OL) indicator or stop code?
For example, if one were running an analysis on QQQQ, is it possible to use the calculation of the average true range (ATR) of SPY (or some other specific symbol) in OL stop or indicator code run on QQQQ - the current symbol being analyzed or charted?
If so, could someone please provide a few lines of sample code to demonstrate this procedure?
Thanks in advance,
Brian Johnson
|
|
Jim Dean
 Icon
    Posts: 1645
Joined: 3/13/2006
Location: Lawrenceville, GA
User Profile |
Hi, Brian:
Here ya have it. Fill in whatever symbol you want ... this shows how it can be set up to choose between several. OLang does not permit input of strings, though.
To prove it out, plot MSFT on the chart, and select option two ... the two ATR lines overlap perfectly.

[Edited by Jim Dean on 7/26/2010 9:28 AM]
Attached file : DemoGetSymATR.png (11KB - 101 downloads)
Attached file : aJDndGetSymATR.rtf (1KB - 16 downloads)
|
|
BDJ
 Member
 Posts: 35
Joined: 5/15/2008
User Profile |
Jim,
As always, I appreciate your prompt and thorough response.
I am experimenting with a volatility based system that is tuned to SPY, but I needed a way to standardize the system across other symbols and I thought of using the ratio of the ATRs.
To test my hypothesis, I need to calculate the ATR of the SPY, while analyzing other symbols. It looks like your sample code will solve my problem. Thanks again.
Brian
|
|
jb
 Veteran
  Posts: 127
Joined: 6/6/2006
User Profile |
Hi all I have just fired up the site the first time for a while to see if I could see how to use a specific symbol in an indicator and before I could do a search I found the answer here. What a good resource this is. Many thanks to you all especially Jim ....JB
|
|
Donald Cole
 Legend
   Posts: 305
Joined: 3/8/2006
Location: Perris,Ca
User Profile |
JB,
Good to see your back Hope all is Good.
|
|
jb
 Veteran
  Posts: 127
Joined: 6/6/2006
User Profile |
Donald thanks very much for the welcome more than kind. I have been having a quick try with Jims code with a variation or two of the symbols it does not seem to like YM.
I am not quite sure whaty to make of the line (30) that defines the ATR source info
xATR = ATR(xH,xL,xC,ATRpds)by having high low and close listed.
The standard ATR only accepts one data set this seems to be some sort of catch whichever data is set approach. I would be grateful for an explanation.
Thanks all...JB
|
|
Jim Dean
 Icon
    Posts: 1645
Joined: 3/13/2006
Location: Lawrenceville, GA
User Profile |
ATR is an overloaded function, like most all OL indicators. You can see the options in the editor by typing ATR( … a helper popup will appear to show you the options. I believe this is documented in Help. I know I've written about this before. Try searching for "overloaded".
|
|
jb
 Veteran
  Posts: 127
Joined: 6/6/2006
User Profile |
Thanks Jim I ll take a look
|