same thing for (Market position is not short)
in MT4 it works perfectly and results match the one in sqx, problem is with MT5.
The strategy is not supposed to open long position if there was already a long position running, in SQX and MT4 this works perfectly and no other long position is opened if there was an existing long position, but in MT5 it open another long position even though there was an open long position running. Vice versa for short positions.
So I took a look inside the mql5 code and found why this is happening.
In MT5, OrdersTotal() returns number of pending orders, where OrdersTotal() in MT4 return number of both market and pending orders.
https://www.mql5.com/en/docs/trading/orderstotal
in MT5, sqMarketPositionIsNotLong() returns (true) all the time because obviously there were no pending orders
Fix is very easy:
in line 3170 of the mql5 code for the strategy attached below, function sqSelectOrder is used inside sqMarketPositionIsNotLong() function, instead change it to sqSelectPosition function, and leave the parameters of the function the same.
do the same thing inside sqMarketPositionIsNotShort().
And it works perfectly for me in MT5, results are exactly the same results I got in SQX
hope this gets fixed in next build
thanks