Hi,
Many topic about that. I kept these lines in my AB bible.
Best regards
Barcount vs BarIndex()
BarCount is a numeric variable that holds just one number (the count of
elements in array).
On the other hand BarIndex() is a function that returns ARRAY
representing consecutive index of each bar.
BarCount IS DYNAMIC, DEPENDENT on ZOOM.
Short advice:
DO NOT use BarCount for ANYTHING else than building a for loop that
iterates through array elements like
this:
for( i = 0 ; i < BarCount; i++ )
{
array[ i ] = H[ i ] + L[ i ];
}
Visible Bars Count
VisibleBars = Status( "LastVisibleBarIndex" ) -
Status("FirstVisibleBarIndex" );// gives a wrong count
With the function GetVisibleBarCount result is correct
function GetVisibleBarCount()
{
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
return Min( Lvb - fvb, BarCount - fvb );
}
VisibleBars = GetVisibleBarCount();
_TRACE("VisibleBars = "+ VisibleBars );
Le 07/08/2010 14:13, mdkumarz a écrit :
Hi,
my understanding is this:
barcount counts all the bars in the chart (not just visible);
so, i have written
printf("bars in the chart:"+barcount);
it's giving different number of bars when zoomed in and zoomed out.
Does barcount look at visible bars only?
Regards,
M D KUMAR