Translate ATR etc from WL4 to WL5
Author: jimcrist
Creation Date: 12/5/2008 9:59 AM
profile picture

jimcrist

#1
Ugh. I'm stuggling. I don't know WL5 and I can't remember WL4. I think this is what confuses me the most. Please translate snippet from WL4 to WL5. Thanks very much!

SetScaleDaily;
hAVGV20 := SMASeries(#Volume, 20);
hAVGC10 := SMASeries(#Close, 10);
hVol := #Volume;
hOpen := #Open;
hClose := #Close;
hHigh := #High;
hLow := #Low;
hATR := ATRSeries(20);
RestorePrimarySeries;

// call this with last bar of day
procedure GetDailyNums;
begin
db := GetDailyBar(Bar);
Vol := @hVol[db];
AVGV20 := @hAVGV20[db];
ATRPts := @hATR[db];
end;
profile picture

Eugene

#2
CODE:
Please log in to see this code.
profile picture

jimcrist

#3
Thanks Eugene. The ATR.Series isn't working as expected. When I run the following code on symbol KR using 15-minute bars the ATRs are in the .4 range, when in fact the current 20 day ATR for KR is 1.35 points. Why the discrepancy? Thanks...
CODE:
Please log in to see this code.
profile picture

Eugene

#4
CODE:
Please log in to see this code.
profile picture

jimcrist

#5
I can't keep my brain around this stuff. I'm doing a intraday strategy, but I want to use compressed data for average volume, ATR, etc. I'm using code similar to the code above. I want to compare the close of an intraday bar with that day's open price. Using the code above, the best I can do is:
CODE:
Please log in to see this code.

The problem with the above code is when the Close[bar] is the last bar of the day, hOpen[DBar+1] gives me the NEXT day's open.
The following code usually gives me yesterday's open:
CODE:
Please log in to see this code.

Thanks for your help...
profile picture

Eugene

#6
You don't need that code at all to find this day's open price:
CODE:
Please log in to see this code.
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).