MQL5 request order fail jush with ...JPY (error 4756; retcode 10021)

 

Hi experts,

I wrote an EA that create order automatically. It's work fine with some symbol like EURUSD, GPBUSD, BTCUSD... but failed with symbols like xxxJPY (USDJPY, GBPJPY...)  with error code 4756 and retcode 10021. Any ideals to help me? Thank and sorry about my bad english language!

This is my code to create order:

bool PositionInit(bool buy_or_sell_1, string symbol, double vol){
   bool is_success = true; int retry_time = 0;
   do
   {
      MqlTradeRequest request;
        MqlTradeResult  result;
        double _price =  0;
        int    digits=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
        double _points = SymbolInfoDouble(symbol, SYMBOL_POINT);
      double tp = 0;
      double sl = 0;
        ZeroMemory(request);
        ZeroMemory(result);
        
        request.action    = TRADE_ACTION_DEAL;
        request.symbol    = symbol;
        request.volume    = vol;
        request.deviation = 5;
        request.magic     = EXPERT_MAGIC;
        
        if(buy_or_sell_1 == true){
           request.type = ORDER_TYPE_BUY;
           //if(retry_time > 10){
           //   _price = SymbolInfoDouble(symbol,SYMBOL_ASK) + retry_time*_points; //mua giá cao
           //}
           //else
           //   _price = SymbolInfoDouble(symbol,SYMBOL_ASK); //mua giá cao
           _price = SymbolInfoDouble(symbol,SYMBOL_ASK); //mua giá cao
        }
        else{
           request.type = ORDER_TYPE_SELL;
           //if(retry_time > 10){
           //   _price = SymbolInfoDouble(symbol,SYMBOL_BID) - retry_time*_points; //bán giá thấp
           //}
           //else
           //   _price = SymbolInfoDouble(symbol,SYMBOL_BID); //bán giá thấp
           _price = SymbolInfoDouble(symbol,SYMBOL_BID);
        }
        
        request.price     = _price;
        request.tp = tp;
        request.sl = sl;
        
      if(!OrderSend(request,result)){
           PrintFormat("Open position symbol %s at price %f and vol %f and type %s error %d",symbol, _price, vol, EnumToString(request.type) , GetLastError());
           PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);  
           is_success = false; retry_time++; Print(IntegerToString(retry_time));
           Sleep(500);
        }
        else{
           is_success = true;
        } 
   }
   while(is_success == false && retry_time < 21 && !IsStopped());
   if(is_success == false){
      AlertOnce("Error ....", 0, false);
   }
   return is_success;
}