Indicator Calculation Direction

 

Someone can explain why some indicators use the “ for(int i=0; i<limit; i++)” direction of calculation and others use “for(i=limit-1; i>=0; i--)” direction?

 

from today's data, you find you should open an order at yesterday, but none can go to past time to do something.

so the important is not direction of calculation, the important is do not use data now to calculate indicator at past.

 
DxdCn:

from today's data, you find you should open an order at yesterday, but none can go to past time to do something.

so the important is not direction of calculation, the important is do not use data now to calculate indicator at past.

Sorry, I still don´t understand, both directions of calculation give the same result but as you can see in some Metaquotes indicators the two directions are used in the same indicator, i.e. Awesome Indicator:

//---- macd
for(int i=0; i<limit; i++)
ExtBuffer0[i]=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,i)-iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,i);
//---- dispatch values between 2 buffers
bool up=true;
for(i=limit-1; i>=0; i--)
{
current=ExtBuffer0[i];
prev=ExtBuffer0[i+1];
if(current>prev) up=true;
if(current<prev) up=false;
if(!up)
{
ExtBuffer2[i]=current;
ExtBuffer1[i]=0.0;
}
else
{
ExtBuffer1[i]=current;
ExtBuffer2[i]=0.0;
}
}

Why??

 

It is often just a matter of style, but not always.

I count from past to present, as my style.

Reason: