This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

The proper sequence to execute Bars


Back to topics list
avatar
394
sub 2005.08.18 09:33 
I have noticed that custom indicators and even sample in the MQL4 manual suggests that the bars should be executed from" i=0 to i<Bars" which is WRONG!
Since bar 0 is most recent bar starting from 0 to maximum bar is like playing tape recorder backwards and it will cause serious problems in predicting future market direction in your EA.

Therefore, the proper sequence should be as follows:

int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
for(i=limit; i>-1; i--)
{
something here...
}

-Stan
Back to topics list  
Download MetaTrader 5 (450 Kb, web installer) — a new terminal for financial markets