PureBytes Links
Trading Reference Links
|
<SPAN
class=974062604-19012004>KK, please excuse if I'm saying stuff you already know,
and please someone set me straight if I'm off base.
<SPAN
class=974062604-19012004>
<SPAN
class=974062604-19012004>As I understand it, in AB *every* array, no matter how
it's used in your code, is sized to the number of bars in the current ticker,
ie, BarCount elements, starting at [0] and ending at [BarCount-1]. For example,
say you needed an array of 10 particular numbers for use as MA periods you want
to cycle through for whatever reason. That array actually has BarCount elements,
always, even if you use only the first 10. For a stock with many years of data,
that's thousands of unused elements. You also need to be careful to access only
array elements that actually exists, or you'll get subscript out of range
errors; that's the reason for stopping your loop at i < BarCount. Watch this
especially when you hit a stock with no data. You can't even put those 10
numbers in an array in that case.
<SPAN
class=974062604-19012004>
<SPAN
class=974062604-19012004>If you're used to programming in other general purpose
languages, you may find this aspect of arrays in AB a little counterintuitive. I
know I did, but they're still really useful.
<SPAN
class=974062604-19012004>
<SPAN
class=974062604-19012004>Dave
<BLOCKQUOTE
>
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
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.
|