[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] AFL - LLV / HHV



PureBytes Links

Trading Reference Links





Period1 = 7;
// Determine Time base
//File: Mod - DateTime<FONT face=Arial 
size=2>//Compute Data Interval
EOD      = IIf(Interval() 
> 5000 AND Interval() < 100000,1,0);Weekly   = 
IIf(Interval() > 100000 AND Interval() < 1000000,1,0);Monthly  = 
IIf(Interval() > 2000000,1,0);RT5s     = 
IIf(Interval() == 5,1,0);RT1      = IIf(Interval() 
== 60,1,0);RT2      = IIf(Interval() == 
120,1,0);RT5      = IIf(Interval() == 
300,1,0);RT15     = IIf(Interval() == 
900,1,0);RT30     = IIf(Interval() == 
1800,1,0);RT60     = IIf(Interval() == 
3600,1,0);RT195    = IIf(Interval() == 
11700,1,0);RT390    = IIf(Interval() == 
23400,1,0);RT       = IIf(Interval() 
<  23401,1,0);Time_Int = Interval() / 60;_N(Period   = 
WriteIf(EOD,"Daily",WriteIf(Weekly,"Weekly",WriteIf(Monthly,"Monthly",""))));
//Compute DateY1  = Year();M1  = 
Month();D1  = Day();_N(DateStamp = WriteVal(M1,1.0) + "/" + 
WriteVal(D1,1.0) + "/" + WriteVal(Y1,1.0));
//Compute TimeHr  = Hour();Mn  = 
Minute();
_N(TimeStamp = WriteVal(Hr,1.0) + ":" + 
WriteIf(Mn<10,"0","") + WriteVal(Mn,1.0) + 
WriteIf(Hr<12,"am","pm"));_N(Time = WriteIf(RT,TimeStamp,""));
// end of time base code<FONT 
color=#0000ff size=1>
_N(QP2_Sym1 = <FONT color=#ff00ff 
size=1>"!COMP");
_N(eSig_Sym1= <FONT color=#ff00ff 
size=1>"$COMPQ");

_N<FONT 
size=1>(Issue1 = WriteIf<FONT 
size=1>(EOD OR Weekly OR Monthly,QP2_Sym1,eSig_Sym1)); 
// Select different symbols based on EOD or RT<FONT 
color=#0000ff size=1>
// Reference Formula: Stoc = ((Close - 
LLV(Low,period)) / (HHV(High,Period)-LLV(Low,Period))) * 100;<FONT 
size=1>
Issue1_C = Foreign<FONT 
size=1>(Issue1,"Close"<FONT 
size=1>);
Issue1_H = Foreign<FONT 
size=1>(Issue1,"High"<FONT 
size=1>);
Issue1_L = Foreign<FONT 
size=1>(Issue1,"Low"<FONT 
size=1>);
Inx1_StocRaw = ((Issue1_C - LLV<FONT 
size=1>(Issue1_L,Period1)) / (HHV<FONT 
size=1>(Issue1_H,Period1)-LLV<FONT 
size=1>(Issue1_L,Period1))) * 100<FONT 
size=1>; // Raw stochastic
 
I am using 
the above formula to compute the raw stochastic of NASDAQ and 
DJ.
This works fine for EOD and RT from 1 min to 60 min 
bars. When I switch to 195 min or 390 min bars, the LLV and HHV calculations 
return {EMPTY} arrays.
 
Anyone see the  problem?
Thanks
Ara
<FONT face=Arial color=#000000 
size=2> 






Yahoo! Groups Sponsor


  ADVERTISEMENT 









Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.