why not execute a command ???

 

hi guys  i have  app that write a txt  with this syntax  in Mql5\Files  EURUSD,BUY,0.10

the mt5  read perfect load  data but  when execute return error  but in my accont i have 10k  and if i run the same command by hand  it works 

my code 

   // ===== COMANDO DO ORDER: "<SYMBOL>,<BUY/SELL>,<VOLUME>" =====
   if(cnt != 3)
   {
      Print("   Formato non valido, skip");
      return;
   }

   string sym  = TrimString(parts[0]);
   string side = TrimString(parts[1]);
   double vol  = StringToDouble(parts[2]);
Print("SYMBOL ricevuto: <", sym, ">");


   ENUM_ORDER_TYPE type = (side == "BUY") ? ORDER_TYPE_BUY : ORDER_TYPE_SELL;

   double price = 0;
   if(!SymbolInfoDouble(sym, (type==ORDER_TYPE_BUY) ? SYMBOL_ASK : SYMBOL_BID, price))
   {
      Print("   ERRORE SymbolInfoDouble(", sym, ")");
      return;
   }

   MqlTradeRequest req={};
   MqlTradeResult res={};
   ZeroMemory(req); ZeroMemory(res);

   req.action    = TRADE_ACTION_DEAL;
   req.symbol    = sym;
   req.volume    = vol;
   req.type      = type;
   req.price     = price;
   req.deviation = 5;
   req.magic     = 123456;
   req.comment   = "AutoIt Bridge";


    PrintFormat("TradeRequest:");
    PrintFormat("  action    = %d", req.action);
    PrintFormat("  symbol    = %s", req.symbol);
    PrintFormat("  volume    = %.2f", req.volume);
    PrintFormat("  type      = %d", req.type);
    PrintFormat("  price     = %.5f", req.price);
    PrintFormat("  sl        = %.5f", req.sl);
    PrintFormat("  tp        = %.5f", req.tp);
    PrintFormat("  deviation = %d", req.deviation);
    PrintFormat("  magic     = %d", req.magic);
    PrintFormat("  comment   = %s", req.comment);
    PrintFormat("  type_filling = %d", req.type_filling);
    PrintFormat("  type_time    = %d", req.type_time);



   if(!OrderSend(req, res))
      Print("   OrderSend fallito, retcode=", res.retcode);
   else
      Print("   Ordine eseguito, ticket=", res.order);
      
      
      
}

my error with debug 

2025.06.05 16:28:41.547 FILE_BRIDGE_DATA (EURUSD,H1)    OnDeinit: EA deinizializzato
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)    SYMBOL ricevuto: <EURGBP>
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)    TradeRequest:
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      action    = 1
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      symbol    = EURGBP
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      volume    = 0.10
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      type      = 1
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      price     = 0.84380
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      sl        = 0.00000
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      tp        = 0.00000
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      deviation = 5
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      magic     = 123456
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      comment   = AutoIt Bridge
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      type_filling = 0
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)      type_time    = 0
2025.06.05 16:28:43.737 FILE_BRIDGE_DATA (EURUSD,H1)       OrderSend fallito, retcode=10030
2025.06.05 16:28:43.738 FILE_BRIDGE_DATA (EURUSD,H1)       File cancellato con successo

anyone  can tell me if i use a bad syntax ? or did do some mistake  ? thanks 

 
Stefano Cerbioni:

hi guys  i have  app that write a txt  with this syntax  in Mql5\Files  EURUSD,BUY,0.10

the mt5  read perfect load  data but  when execute return error  but in my accont i have 10k  and if i run the same command by hand  it works 

my code 

my error with debug 

anyone  can tell me if i use a bad syntax ? or did do some mistake  ? thanks 

Error code 10030: TRADE_RETCODE_INVALID_FILL

Wrong filling mode specified.