Here is the problem.
I want to have the number of bars between a fixed starting point to the current bar, the Bar[0]. For the starting point, I have chosen the moment when the faster moving average crosses above the slower one. At this moment, I save the index of the bar in int startP. On the output window, I have 3758, 3759…. Minutes later, couple of bars are printed on the chart from the starting point stardP. I want to know the number of bars between these two points (Bar[0] and startP). I make the following calculation. int barsDiff = CurrentBar - startP. On the output window, I have the value 0. It can not be zero, because I can count manually the bars and I have at least 10 bars.
Here is the piece of my code:
if(myFasterMA CrossesAbove mySlowerMA)
{
if(!flagUp)
{
int startP = CurrentBar;
falgUp = true;
}
int barsDiff = CurrentBar-startP;
}
Thanks in advance!

Comment