I know Molanis doesn't like it when people fiddle with the code, however, I kind of figured out how to do it, so I thought I would share with those who may look it up in the future (especially since a few people had a look at the topic).
It does not involve using Molanis, instead I changed the EA Mql4 code. I am not an expert in coding so if anybody has a better suggestion or if this is incorrect, please say so. As always, make sure you try it out on demo first.
I added this into the EA code:
int start(){
//manage open orders here
if (OrdersTotal() > 0){ return(0); }
//open new orders here
}
This checks how many orders are already open. So if there is more than 0 orders open, (regardless if they are buy or sell orders) then it will not open new orders. If you want a buy and sell order to be happening at the same time, then the setting for "hedge" must be "true" and the broker must allow it.
|