You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi everyone,
I wish to know if this is the correct way to calculate indicator's value in a for loop (throughout all the available bars):
int OnCalculate(...)
{
//...
ArraySetAsSeries(SignalLine,false);
//...
for(int i=0; i<Bars; i++)
{
double ma=iMA(NULL,0,MaPeriod,0,MaMethod,MaPrice,i);
//...
SignalLine[i]=ma;
}
//...
}
return rates_total
}
P.S. Logically in this simple case I would like to represent and plot a MA replication by iMA object. But I am not sure of how I set the loop. I get a bit of difference compared to the one calculated with built-in MT4. I cannot figure out why!
Thanks