Am a little confused ... my impression was that BarIndex() always returned 
value based on entire array.

I always used code below to get the array index:
bi = barindex();
ai = bi - b[0];




From: dturtle887 
Sent: Tuesday, July 27, 2010 2:52 PM
To: [email protected] 
Subject: [amibroker] Is anybody bothered by BarIndex change in version 5.30?


  
Hi All,

My AFL code that I use for charting/explorations/signal generation and 
real-time trading relies on the BarIndex function as implemented in AB versions 
prior to 5.30. Upgrading to 5.30 broke my code and I found out with surprise 
that the reason for that was the new behavior of the BarIndex command. To quote 
from the User's Guide: "BarIndex() now returns values always starting from zero 
(even if QuickAFL is turned on)" which means that BarIndex no longer returns 
absolute bar numbers. For example, LastValue( BarIndex()) is now ALwAYS equal 
BarCount- 1 (which makes it useless for new bar detection, for example).

The recommended workaroud is to use SetBarsRequired( sbrAll). However, this is 
not a good option because it can slow down execution considerably for a formula 
of any complexity and a database size > some 1000 bars.

In my opinion, the old behavior of the BarIndex function was exactly what was 
needed because it made possible to use QuickAFL and to access absolute bar 
numbers at the same time.

So I am just wondering whether I am the only one impacted by the change or 
maybe not enough users tried to upgrade to ver 5.30 to find out yet?

Regards,
Don



Reply via email to