why my pending order not go at market but cancell it ?

 

Hi guys  in my program i have part of code  that  send in chart a limit  order i sett it   but  the strange  effect is : when market price touch a limit price , the  trade not go  in execution and  disappear from chart like cancel , why ? ?this 

this is my code

void ExecuteOrders(double lotSize, double entryPrice1, double stopLoss1, double takeProfit1,
                   double entryPrice2, double stopLoss2, double takeProfit2, 
                   int orderType1, int orderType2)
{
    MqlTradeRequest request1 = {};
    MqlTradeResult result1 = {};
    request1.action = TRADE_ACTION_PENDING;
    request1.symbol = _Symbol;
    request1.volume = lotSize;
    request1.deviation = 10;
    request1.magic = 0;
    request1.type = orderType1;
    request1.price = entryPrice1;
    request1.stoplimit = 0;
    request1.sl = stopLoss1;
    request1.tp = takeProfit1;

    MqlTradeRequest request2 = {};
    MqlTradeResult result2 = {};
    request2.action = TRADE_ACTION_PENDING;
    request2.symbol = _Symbol;
    request2.volume = lotSize;
    request2.deviation = 10;
    request2.magic = 0;
    request2.type = orderType2;
    request2.price = entryPrice2;
    request2.stoplimit = 0;
    request2.sl = stopLoss2;
    request2.tp = takeProfit2;

    // Invia il primo ordine
    if (OrderSend(request1, result1) != -1)
    {
        g_ticket1 = result1.order;
        Print("Ordine 1 inviato con ticket: ", g_ticket1);
    }
    else
    {
        Print("Errore nell'invio del primo ordine");
        return;
    }

    // Invia il secondo ordine
    if (OrderSend(request2, result2) != -1)
    {
        g_ticket2 = result2.order;
        Print("Ordine 2 inviato con ticket: ", g_ticket2);
    }
    else
    {
        Print("Errore nell'invio del secondo ordine");
        return;
    }

    // Impostiamo il ticket dell'ordine da cancellare
    if (g_ticket1 != 0 && g_ticket2 != 0)
    {
        g_ticketToCancel = g_ticket2;  // Se il primo ordine è valido, cancelliamo il secondo
    }
    else if (g_ticket2 != 0 && g_ticket1 == 0)
    {
        g_ticketToCancel = g_ticket1;  // Se il secondo ordine è valido, cancelliamo il primo
    }
}

 
Stefano Cerbioni:

Hi guys  in my program i have part of code  that  send in chart a limit  order i sett it   but  the strange  effect is : when market price touch a limit price , the  trade not go  in execution and  disappear from chart like cancel , why ? ?this 

this is my code

one reason could be there is not enough margin to open it

 
Lorentzos Roussos #:

one reason could be there is not enough margin to open it

no i have margin i open 0.10 lot   in XAUUSD with  1030.34 dollar wallet  in  1:30 leverege if i open by hand work it

 
Stefano Cerbioni #:

no i have margin i open 0.10 lot   in XAUUSD with  1030.34 dollar wallet  in  1:30 leverege if i open by hand work it

what does the journal tab say when it cancels it

also increase the deviation try 1000