Order failed due to Invalid price

 

Hi

A mql5 EA placed an limit sell order but the log shows failed due to Invalid Price. Any idea how to start to find the problem?

Notice that the prices are all good in the order but the results.ask and result.bid are both 0.0. Why is that?


Thank you


Here is the log file content:

KH 0 20:56:08.811 Trades '212121': sell limit 0.05 EURNZD at 1.71421 sl: 1.73645 tp: 1.71195

PE 2 20:56:09.076 Trades '212121': failed sell limit 0.05 EURNZD at 1.71421 sl: 1.73645 tp: 1.71195 [Invalid price]


Here is the code print out:

2019.05.31 20:56:09.076 myEA (EURNZD,H1) TradeLog: Trade request failed. Error = 4756

2019.05.31 20:56:09.076 myEA (EURNZD,H1) TRADE_RETCODE_INVALID_PRICE

2019.05.31 20:56:09.076 myEA (EURNZD,H1) request.price = 1.71421   result.ask = 0.0 result.bid = 0.0


bool myOrderSend(MqlTradeRequest &request,MqlTradeResult &result) 
  { 
   ResetLastError(); 
   bool success=OrderSend(request,result); 
   if(!success) 
     { 
      int answer=(int)result.retcode; 
      Print("TradeLog: Trade request failed. Error = ",GetLastError()); 
      switch(answer) 
        { 
         case 10004: 
           { 
            Print("TRADE_RETCODE_REQUOTE"); 
            Print("request.price = ",request.price,"   result.ask = ", 
                  result.ask," result.bid = ",result.bid); 
            break; 
           } 
         case 10006: 
           { 
            Print("TRADE_RETCODE_REJECT"); 
            Print("request.price = ",request.price,"   result.ask = ", 
                  result.ask," result.bid = ",result.bid); 
            break; 
           } 
         case 10015: 
           { 
            Print("TRADE_RETCODE_INVALID_PRICE"); 
            Print("request.price = ",request.price,"   result.ask = ", 
                  result.ask," result.bid = ",result.bid); 
            break; 
           } 
         case 10016: 
           { 
            Print("TRADE_RETCODE_INVALID_STOPS"); 
            Print("request.sl = ",request.sl," request.tp = ",request.tp); 
            Print("result.ask = ",result.ask," result.bid = ",result.bid); 
            break; 
           } 
         case 10014: 
           { 
            Print("TRADE_RETCODE_INVALID_VOLUME"); 
            Print("request.volume = ",request.volume,"   result.volume = ", 
                  result.volume); 
            break; 
           } 
         case 10019: 
           { 
            Print("TRADE_RETCODE_NO_MONEY"); 
            Print("request.volume = ",request.volume,"   result.volume = ", 
                  result.volume,"   result.comment = ",result.comment); 
            break; 
           } 
         //--- some other reason, output the server response code  
         default: 
           { 
            Print("Other answer = ",answer); 
           } 
        } 
      return(false); 
     } 
   return(true); 
  }
 
samjesse:

Hi

A mql5 EA placed an limit sell order but the log shows failed due to Invalid Price. Any idea how to start to find the problem?

Notice that the prices are all good in the order but the results.ask and result.bid are both 0.0. Why is that?


Thank you


Here is the log file content:

KH 0 20:56:08.811 Trades '212121': sell limit 0.05 EURNZD at 1.71421 sl: 1.73645 tp: 1.71195

PE 2 20:56:09.076 Trades '212121': failed sell limit 0.05 EURNZD at 1.71421 sl: 1.73645 tp: 1.71195 [Invalid price]


Here is the code print out:

2019.05.31 20:56:09.076 myEA (EURNZD,H1) TradeLog: Trade request failed. Error = 4756

2019.05.31 20:56:09.076 myEA (EURNZD,H1) TRADE_RETCODE_INVALID_PRICE

2019.05.31 20:56:09.076 myEA (EURNZD,H1) request.price = 1.71421   result.ask = 0.0 result.bid = 0.0


The posted code says nothing. You should post the code where you are filling your request, something is wrong with it.
Reason: