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
it is enough to calculate the things you want once per bar. that is why I mentioned new bar checking. there are several ways to check, below is an example.
this returns true when a new bar is formed (it happens after when the the next (#1) bar is completed).
This works also:
Is the MACD_sample.mq4 example distributed with MetaTrader then wrong?
There is no checking of a new bar.
The calculation of MACD is not shifted by 1.
When I include isNewBar in the example, backtesting results are different, the same if I shift by 1.
That's not good as example.
This works also:
It won't when Bars = Max bars on chart because the value of Bars will no longer increment. Always use time.
The MACD sample will perform these calculations for each tick . . .