PureBytes Links
Trading Reference Links
|
Dimitris, Dingo, Herman, Graham,
Thanks to all for your replies. The trick that did it was the
SetBarsRequired(10000,10000);
statement. What is confusing is that the explaination for this
function says that it is not needed if you are using pure AFL, only
if you are writing scripts or dll's. Anyone have an idea about this?
For reference, the statement
for(i = StartDate; i < EndDate + 1; i = i + 1)
does work. The i < EndDate + 1 stops the calculation at i = EndDate.
Finally, the PHigh[i] statement can be PHigh (without the [i]) if you
only use PHigh as a scalar in your later statements within the loop.
The code works fine either way.
Dingo, I'm confused that the code ran for you the way it was
supplied. I am using V4.50. Are you using a later beta version?
Thanks again for your help.
Bill
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> 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 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/
|