Total Number for Bars in the complete data of a script

How can we count the total number of days in the complete data? When I increase the selection it shows a bigger range attaching a picture for the reference.

Code used is

Newday = Day()!=Ref(Day(),-1);
Total_Days=0;

for( i = 0; i < BarCount; i++ )
{
Total_Days = Total_Days + Newday[i];
}
GfxTextOut("Total_Days:  "+ Barnumber, 20, 120 );

SMALLER SELECTION
BIGGER SELECTION

QuickAFL!

Also you do not need looping!

SetBarsRequired(sbrAll);
Newday = Day()!=Ref(Day(),-1);
Total_Days = Cum(Newday);
GfxTextOut("Total_Days:  "+ Total_Days, 20, 120 );

It seems that you have a bug in your code. I think that:

should be:

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.