How to get the No. of bars in Tick by Tick Data

Hi, I just need to count the total no. of bars in a tick by tick data, so that I can run the for loop for those many number of bars on a array. I am using barcount and numbars... but that is not giving me the correct information I believe. I am using the following:

dn = DateNum();
Newday = dn != Ref( dn, -1);
BarNum = BarsSince(Newday);
Numbars = SelectedValue(BarNum);

for( bar = BarCount - Numbars; bar < BarCount; bar++)
{
if ((V[bar] > 24999) AND (V[bar] <30000))
{
Count5 = Count5 + 1;
continue;
}
}
Can anyone please help what is the right way to count the no. of bars in tick by tick data.

Firstly, please wrap your code in code blocks.

Secondly, "that is not giving me the correct information I believe" is not a good diagnosis of the problem because it does not tell anyone what information it's giving you or what you believe. So all we know is that you think it's wrong.
Is there an error? What's the error? Is there no error? What is wrong?

Thirdly, your Numbars is a value, meaning it's a price or value of an index but you're using it in the for loop as a bar index, this is one logical error that I can spot.

G'luck!

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