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

[amibroker] AFL Puzzle



PureBytes Links

Trading Reference Links

The following simple code works only ones, when I double click on the
indicator (called TEST). The plot is perfect.

bi = BarIndex();
dt_array = DateTime();
Trade_dt=dt_array[SelectedValue(bi)];
Trade_dt_text = DateTimeToStr(Trade_dt);

Trade_flag = IIf(dt_array == Trade_dt,1,0);
Plot(Trade_flag,"F",colorRed);

The moment I click on the chart or indicator (refresh) there is an error:
Error 10
Substrict out of range.
You must not access array elements outside 0..(Barcount -1) range.
Error is at Trade_dt_text .....

I know how to fix it. Just insert in the very beginning
SetBarsRequired(100000,0);, but that's not the point.

1.Why does it work the first time , but not the second and the
following refreshes ?
2.There is a price to pay for it. Execution time increases
dramatically. The SelectedValue is almost in every case at the very
end of the chart. Quick AFL should cover such cases, but it seems that
DateTime() is excluded from quick AFL. Is it true?

I will appreciate some explanation, so I can write more efficient
software. Thank you in advance.

AF  



------------------------------------

**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com
*********************

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html

*********************************
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> 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/