Can someone please help me with this? Very much appreciated.
How can I compare pending orders with defined price? Suppose I want to open pending order at 1.0590, 1.0580, 1.0570 and 1.0560, I want to compare and check if any pending order missing. Lets say 1.0570 already executed (market price hit) EA should compare, find missing level and open a pending order at 1.0570.
Thanks in advance.
int ordersTotal = OrdersTotal();
//--- search in all open positions
for (int i = ordersTotal - 1; i >= 0; i--)
//--- if an error occurs at selecting of this position then go to the next one...
if (!OrderSelect(i, SELECT_BY_POS)) continue;
//--- if the position was opened not for the current symbol, skip it...
if (OrderSymbol() != Symbol()) continue;
//--- if the OrderMagicNumber() is not equal to MagicNumber skip this position...
if (MagicNumber > 0 && OrderMagicNumber() != MagicNumber) continue;
... you can add your conditions here ...
Put all orders into a struct array as they are being passed and that way you have to reference. I do it all the time.
are you using MT4 or MT5?