Download MetaTrader 5
To add comments, please log in or register
How to choose the most appropriate signal and subscribe to it in no time
gangsta1
1117
gangsta1 2016.09.28 21:58 

Since latest mt4 update, when I compile my EA I am getting the 'i' - undeclared identifier error but cannot see which part of this code is causing it:

void CloseOrderSell()
{
    if ((Ask-Bid) <= MaxSpread*PipValue*Point)
{
    int orderstotal = OrdersTotal();
    int orders = 0;
    int ordticket[30][2];
    for (int i = 0; i < orderstotal; i++)
    {
        if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
        if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != MagicNumberSell)
        {
            continue;
        }
        ordticket[orders][0] = OrderOpenTime();
        ordticket[orders][1] = OrderTicket();
        orders++;
    }
    if (orders > 1)
    {
        ArrayResize(ordticket,orders);
        ArraySort(ordticket);
    }
    for (i = 0; i < orders; i++)
    {
        if (OrderSelect(ordticket[i][1], SELECT_BY_TICKET) == true)
        {
            bool ret = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MaxSlippage, Red);
            if (ret == false)
            Print("OrderClose() error - ", ErrorDescription(GetLastError()));
        }
    }
    
}
}
Gordon Gekko
643
Gordon Gekko 2016.09.28 22:02  
for (int i = 0; i < orders; i++)
gangsta1
1117
gangsta1 2016.09.28 22:12  
ggekko:


Thank you for pointing that out :-)
/
To add comments, please log in or register