See attached images for explanation of bug. As talked about in SQ Extension/Programming this morning.
Status changed from New to In progress
Unfortunately, this is a known problem with the MT5 netting account. When you run multiple EA in one account when there is 1 buy and 1 sell order from 2 different EAs. It will net out the trade eventually.
https://www.mql5.com/en/forum/372599
The close position function in SQX will always detect if there is an existing trade only it will perform a close position when the "Long exit" or "Short exit" signal happens.
There are 2 methods to do this
For method 1, you can apply the existing EA to multiple accounts. However, method 2 will be slightly complicated. I will make some explanation over here.
First, you need to remove the condition, Market Position (Any, Magic Number, " ") is Long or Short. This is because the trade has been closed by the other trade. You couldn't detect whether the trade was long or short anymore.
Second, you need to add a boolean parameter to track whether you have entered trade or not. So in your entry tab, you need to assign "True" to this variable. You can use this parameter to keep track you have open trade or not. Remember this parameter will reset to default when you restart your strategy. If you have long and short in 1 strategy, you might need to add 2 parameters to keep track of both.
Third, you can use the second step parameter to detect whether you have open trade or not. If you have open trade, you can perform the exit signal.
Fourth, the close position will detect if there is an active order and perform the close. However, in your scenario, there is no active order. You can use the "EnterAtMarket" block to exit the trade. So, when you have an active long order, you can perform a Short "EnterAtMarket" to exit your long order or a Long "EnterAtMarket" to exit your short order.
I understand that this scenario is complicated. However, when we ran multiple EA in a netting MT5 account, the MT5 netted the trades which made us unable to track all the open trades. Therefore, it required us to take extra steps in the strategy to track every single trade.
Thank you.
These strategies execute on a M15 Timeframe both need to be the same symbol.
Long at 0 min, Exit at 30 min
Short at 15 min, Exit at 45 min