From the 1045 version has made its appearance a serious mistake: When sending in sequence two orders of opposite direction, the second order, sometimes runs in the wrong direction plus without entering the comment and magic number. I find myself in substance to have two buy or two sell instead of one for type, one of which being with MagicNumber 0 is not be managed by my EA which controls only its orders.
I find the following message on the log that is truly terrifying: 2 15: 44: 00,305 sdDynamicGrid v10b EURUSD, M5: open # 50135621 buy (instead of sell) 1.10 EURUSD at 1.07529 ok
In backtest everything works fine. only real occurs, occasionally, this terrible mistake.
Ok, here the code:
Print("Send new V2A and V2B...");
int iFool = OrderSend(Symbol(),OP_BUY, Lots,Ask,3,0,0,EA_NAME + "A LONG" ,MagicNumber ,0,clrGreen);
iFool = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,0,0,EA_NAME + "B SHORT",MagicNumber+1,0,clrRed);
Print("ERROR !!!! Safety closure.");
OpenedOrders function returns the numbers of opened orders for specific magic number and CloseAllOrders function close all the order with specific magic number.