PureBytes Links
Trading Reference Links
|
Hello,
Yes count=0 at the beginning initialises properly all elements
to zero.
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=kk2628@xxxxxxxxxxxxxxxx
href="">kk2628
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, January 18, 2004 9:54
AM
Subject: Re: [amibroker] Strange
subscript out of range
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 -----
<BLOCKQUOTE
>
<DIV
>From:
Herman
vandenBergen
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, January 18, 2004 1:03
PM
Subject: RE: [amibroker] Strange
subscript out of range
<FONT face=Arial
color=#0000ff>If you use the subscript <FONT
color=#000000>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:
<FONT
face=Arial>Count=0<FONT
size=2>; j=<FONT
color=#ff00ff>1<FONT
color=#000000>; for<FONT
color=#000000>(j=1;
j<BarCount<FONT
size=2>; j++) {
if<FONT
color=#000000>(j<<FONT
color=#ff00ff>500<FONT
color=#000000>) Count[j]++; <FONT
color=#ff0000>else Count[j]=<FONT
color=#ff00ff>0<FONT
color=#000000>; } <FONT
color=#0000ff>Plot(Count,<FONT
color=#ff00ff>"",<FONT
color=#ff0000>colorRed,<FONT
color=#ff0000>styleHistogram<FONT
color=#000000>|4<FONT
size=2>); <FONT
color=#ff0000>GraphXSpace = <FONT
color=#ff00ff>5<FONT face=Arial
size=2>;
<FONT face=Arial
size=2>However, I think what you are looking for
is this:
<FONT
face=Arial>Count=0<FONT
size=2>; j=<FONT
color=#ff00ff>1<FONT
color=#000000>; for<FONT
color=#000000>(j=1;
j<BarCount<FONT
size=2>; j++) {
if<FONT
color=#000000>(j<<FONT
color=#ff00ff>500<FONT
color=#000000>) Count[j] = j; <FONT
color=#ff0000>else
Count[j]=null<FONT
color=#000000>; } <FONT
color=#0000ff>Plot(Count,<FONT
color=#ff00ff>"",<FONT
color=#ff0000>colorRed,<FONT
color=#ff0000>styleHistogram<FONT
color=#000000>|4<FONT
size=2>); <FONT
color=#ff0000>GraphXSpace = <FONT
color=#ff00ff>5;
<FONT
face=Arial>G<SPAN
class=030401804-18012004>ood
luck,
<SPAN
class=030401804-18012004><SPAN
class=030401804-18012004><FONT
color=#0000ff>h<SPAN
class=030401804-18012004>erman
<FONT face=Arial
size=2>
<FONT face=Arial
size=2>
<FONT face=Arial
size=2>-----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=<FONT
color=#ff00ff>0<FONT face=Arial
size=2>;
j=<FONT
face=Arial>1<FONT
color=#000000>;
for<FONT
face=Arial>(j=1<FONT
color=#000000>; j<=<FONT
color=#ff00ff>500;
j++)
{
Count[j]++;
}
Plot<FONT
face=Arial>(Count,<FONT
color=#ff00ff>""<FONT
color=#000000>,colorRed,styleHistogram|<FONT
color=#ff00ff>4<FONT
color=#000000>);
<FONT
face=Arial size=2>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend
SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>--------------------------------------------Check
group FAQ at: <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
size=2>
Yahoo! Groups Links
To visit your group on the web, go
to:<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/<FONT
face=Arial size=2>
To unsubscribe from this group, send an
email to:<A
href=""><FONT
face=Arial
size=2>amibroker-unsubscribe@xxxxxxxxxxxxxxx<FONT
face=Arial size=2>
Your use of Yahoo! Groups is subject to the
<FONT face=Arial
size=2>Yahoo! Terms of Service.
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
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
ADVERTISEMENT
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.
|