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

[amibroker] Intraday indicator loop question



PureBytes Links

Trading Reference Links

I am currently doing some backtesting on a bunch of (1 minute) 
intraday data and am looking to create a few indicators that 
accumulate throughout the day but reset to a certain level at the 
beginning of every new day.  However, I am an inexperienced 
programmer and am not yet very proficient at creating loops.  Perhaps 
someone out there can help me.  How can I create an indicator with a 
loop that shows the intraday high and low?

Here's what I tried so far (it didn't work)...


IntradayH[0]=High[0];
IntradayL[0]=Low[0];

for(i=1;i<BarCount;i++)
{
if(TimeNum()==093000)
{
IntradayH[i]=High[i];
IntradayL[i]=Low[i];
}
else
{
IntradayH[i]=max(IntradayH[i-1], High[i]); 
IntradayL[i]=min(IntradayL[i-1], Low[i]);
}
}
Plot( IntradayH, "High", 27); Plot( IntradayL, "Low", 32);


NOTE:  I know that I can create the intraday high/low with the 
following AFL code...

IntradayH = IIf(TimeNum() == 930000, High, HHV(High, BarsSince(TimeNum
() == 093000)));
IntradayL = IIf(TimeNum() == 930000, Low, LLV(Low, BarsSince(TimeNum
() == 093000)));

...but I want to know how to do it with a loop because I have a 
couple of other ideas that also need to be reset at the beginning of 
each day, but are too complex to code without a loop (without the 
program crashing).  If anyone can help it would be much appreciated.

Greg



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

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 http://docs.yahoo.com/info/terms/