'i' - undeclared identifier

To add comments, please log in or register
gangsta1
1614
gangsta1  

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
629
Gordon Gekko  
for (int i = 0; i < orders; i++)
gangsta1
1614
gangsta1  
ggekko:


Thank you for pointing that out :-)
nicholish en
2676
nicholish en  
Stoyan Roev:

I have the same problem. Undeclared identifier for Li_20 on before last line. Any idea where is my mistake?


I doubt anyone here will be willing to help you debug decompiled code. In fact, if I were you I'd remove it before the moderator sees it.

William Roeder
22376
William Roeder  
Stoyan Roev: . Undeclared identifier for Li_20 on before last line. Any idea where is my mistake?

Ask the owner of the source code to give it to you or have him fix it for you.

Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft.
          See also forum.MQL4.com/41864#490649

If you post decompiled code again, you will likely be banned.

Don't tell us you found it on the 'net: if someone stole your bank details and uploaded them on to the internet, is it OK for everyone to use them because "someone uploaded it, I don't know why I can't use that"?

To add comments, please log in or register