PureBytes Links
Trading Reference Links
|
K,
Regarding BarCount, Tomasz has indicated it's sole job is to be used in For Next Loops.
Herman can clarify and check me on this, but BarCount is the number of bars for a given symbol, and it is the number of bars a symbol has that dictates the size of the array. By setting j<BarCount, you ensure the Count array is fully populated according to the number of bars for the symbol.
Look in the help file under Array, and you'll see a better explaination of Tomasz in terms of how AFL organizes data.
Kind Regards,
Gary
kk2628 <kk2628@xxxxxxxxxxxxxxxx> wrote:
Hi Herman,
Thanks for your help. Just for discussion purpose, isn't count=0 at the beginning of my code should have initialise all count array to 0 (zero) ?
The problem is solved after I changed the for(j=1;j<500;j++) to for(j=1;j<barcount;j++). The key is using barcount, although I'm still not really understand the rationale behind but it is working now.
Graham, thanks to you too. That is another way to do it but a bit slow.
best regards
KK
----- Original Message -----
From: Herman vandenBergen
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, January 18, 2004 1:03 PM
Subject: RE: [amibroker] Strange subscript out of range
If you use the subscript Count[j]++; you are filling the array starting at position zero, up to Count[500] in your case. All bars beyond index 500 will contain a NULL (-1e10) and this is an unacceptable values for an array subscript. I am not sure what you are trying to do, but the following code would ensure that your subscript stays in a valid range:
Count=0; j=1; for(j=1; j<BarCount; j++) { if(j<500) Count[j]++; else Count[j]=0; } <FONT
color=#0000ff>Plot(Count,"",colorRed,styleHistogram|4); GraphXSpace = 5;
However, I think what you are looking for is this:
Count=0; j=1; for(j=1; j<BarCount; j++) { if(j<500) Count[j] = j; else Count[j]=null; } Plot<FONT
color=#000000>(Count,"",colorRed,styleHistogram|4); GraphXSpace = 5;
Good luck,
herman
-----Original Message-----From: kk2628 [mailto:kk2628@xxxxxxxxxxxxxxxx]Sent: January 18, 2004 11:50 AMTo: amibroker@xxxxxxxxxxxxxxx; bugs@xxxxxxxxxxxxxSubject: [amibroker] Strange subscript out of range
Hi TJ,
The following is just a simple for loop. What I do not understand is I'll get the subscript out of range error when there is about a year data show on screen. When I use the zoom out button so that the screen will show more data (may be 6 years), then the subscript out of range error not happening. TJ, would appreciate your clarification.
Tks
KK
Count=0;
j=1;
for(j=1; j<=500; j++)
{
Count[j]++;
}
Plot(Count,"",colorRed,styleHistogram|4);
Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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 the Yahoo! Terms of Service. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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 the Yahoo! Terms of Service. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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 the Yahoo! Terms of Service.
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
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 the Yahoo! Terms of Service.
|