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

RE: [amibroker] Re: For loop help



PureBytes Links

Trading Reference Links

The solution is to add a line in the beginning [and change PHigh to 
PHigh[i]].
Try the

SetBarsRequired(1000,1000); 
Range = 20;
EndDate = LastValue(BarIndex());
StartDate = EndDate - Range + 1;
for(i = StartDate; i < EndDate + 1; i = i + 1)
{
PHigh[i] = H[i];
}
Plot(PHIGH,"",1,1);
Dimitris Tsokakis
--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> EndDate = LastValue(BarIndex());
> i < EndDate + 1 which is saying LastValue(BarIndex()) +1 
> 
> You are specifying the last bar past the end of the charts 
> The last bar is LastValue(BarIndex())
> So use i < EndDate but depending on your formula if it looks into 
the future
> you may need to move the enddate further back with any future look 
forwards.
> 
> You can also replace i=i+1 with just i++
> And you may need to have the Phigh as Phigh[i]
> 
> 
> 
> Cheers,
> Graham
> http://www.golala.com/forums/?mforum=asxsharetrading
> http://groups.msn.com/fmsaustralia 
> 
> -----Original Message-----
> From: billbarack [mailto:wbarack@x...] 
> Sent: Wednesday, 28 January 2004 4:24 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] For loop help
> 
> 
> Can anyone find out why I'm getting a "Error 7 Subscript out of 
> Range" error statement on the following code?
> 
> Range = 20;
> EndDate = LastValue(BarIndex());
> StartDate = EndDate - Range + 1;
> for(i = StartDate; i < EndDate + 1; i = i + 1)
> {
> 		PHigh = High[i];
> }
> 
> I've tried everything I could think of to understand this (even 
> reading and re-reading the help files :>)  ). These senior moments 
> are starting to happen far to often for me !
> 
> Thanks,
> 
> Bill
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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 
> 
> ------------------------ Yahoo! Groups Sponsor ---------------------
~--> Buy
> Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark 
Printer
> at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
> http://www.c1tracking.com/l.asp?cid=5511
> http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
> --------------------------------------------------------------------
-~->
> 
> Yahoo! Groups Links
> 
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/amibroker/
> 
> To unsubscribe from this group, send an email to:
> amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
> Your use of Yahoo! Groups is subject to:  
http://docs.yahoo.com/info/terms/


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 

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/amibroker/

To unsubscribe from this group, send an email to:
 amibroker-unsubscribe@xxxxxxxxxxxxxxx

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/