As I wasn't be able to work it out, then I tried the expert shared.mql which is explained in the MQL4 book (with the rocseparate indicator). My surprise is that when I try a backtesting to the shared.ex4 it happens tha same. It opens a lot of orders in the same bar (and the shared EA is supposed to work with just one open order as well).
What am I missing?
- No mind readers here. Do you really expect us to know what a shared.mql or rocseparate is? Or do you expect us to go looking for it?
- No mind readers here. Unless you post your code, we can only guess.
- Does those EAs automatically adjust for 4/5 digit brokers? If not did you adjust the parameters manually for your 5 digit broker?
I would would try it with a bool (e.g. bool OpenPositon). Set it to true after you opened a position and to false when you closed your position.
Then add OpenPosition == false to your trading conditions.
Hope it helps...
- No mind readers here. Do you really expect us to know what a shared.mql or rocseparate is? Or do you expect us to go looking for it?
- No mind readers here. Unless you post your code, we can only guess.
- Does those EAs automatically adjust for 4/5 digit brokers? If not did you adjust the parameters manually for your 5 digit broker?
Shared.mq4 and roc separate,mq4 are example in MQL4 book - https://book.mql4.com/samples/shared and https://book.mql4.com/samples/iroc.
Quique, you have to modify the code so that the EA can only open 1 position per bar or open 1 position only. There are plenty discussion on that in this forum, use search https://www.mql5.com/en/search and you will find this for example https://www.mql4.com/search#!keyword=one pe bar&module=mql4_module_forum
Thank you very much for your help. I'll look into every answer you gave.
Thanks a lot !
There is another reason that program https://book.mql4.com/samples/shared was made in 2007 and not supporting 5 digit accounts
If you test with same settings on 5 digit account your StopLoss and TakeProfit is not pips but points
So you will hit those settings more often...

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I'm learning mql4 and tried my first EA. I did a Backtesting. I found that my expert was sending a lot of orders at the same next bar once the buy/sell condition was given. The problem is that I programmed it to work with just one market order (i.e. system must be always buyed or selled).
As I wasn't be able to work it out, then I tried the expert shared.mql which is explained in the MQL4 book (with the rocseparate indicator). My surprise is that when I try a backtesting to the shared.ex4 it happens tha same. It opens a lot of orders in the same bar (and the shared EA is supposed to work with just one open order as well).
What am I missing?
Please help as I am a very new MQL programmer.
Thanks.