Direction of Calculating an indicator
standard indicator loop is:
for(int i=Bars-counted_bars-1;i>=0;i--){ }
I don't know what you mean with 'because of the future values'
New bars form on the right hand side of the chart . . . shouldn't every Indicator always work from left to right ? this is what an Indicator has to do when working in real time . . .
I don't have much experience with Indicators but I was working on an Indicator for a friend . . . I wasted 6 hours trying to figure out why my code wasn't working and then realised it was because the original code was working the existing bars from right to left and new bars from left to right.
I think your code looks OK . . but do you need to do this . . .
if (ExtCountedBars>0) ExtCountedBars--; // and . . . this int i,pos=Bars-ExtCountedBars -1;
Hi,
I want to program an indicator.
Normally I am using this loop in my indicators:
But when I am using this loop, the indicator is calculated from today to the past and than the actual values every tick.
Now for my new indicator it is very important, that I can also calculate the past values from the beginning of the first bar of the chart.
I hope you can understand me, I need the values from the past first and then the newer...
I think, I can't change my for-loop from
for(i=pos; i>0;i--) because of the future values??