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...
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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