Failed to open buy order. Error code: 4756 (10013 - invalid request)

 

Hello!

I am trying to send a market order programmatically via my MQL5 demo account on *********** via my EA and via this code:

void OnTick()
  {
   ExtExpert.OnTick();
   if (!executed) {
         MqlTradeRequest mrequest;  // To be used for sending our trade requests
         MqlTradeResult mresult;    // To be used to get our trade results
	 ZeroMemory(mrequest);
         mrequest.action = TRADE_ACTION_DEAL;                                  // immediate order execution
         mrequest.price = NormalizeDouble(SymbolInfoDouble(_Symbol,SYMBOL_ASK),_Digits);
         mrequest.sl = NormalizeDouble(0,_Digits);
         mrequest.tp = NormalizeDouble(0,_Digits);
         mrequest.symbol = _Symbol;                                            // currency pair
         mrequest.volume = NormalizeDouble(0.01,2);                      // number of lots to trade
         mrequest.magic = 12345;                                             // Order Magic Number
         mrequest.type = ORDER_TYPE_BUY;                                        // Buy Order
         mrequest.type_filling = ORDER_FILLING_FOK;                             // Order execution type
         mrequest.deviation= 100;
         OrderSend(mrequest,mresult);
	 executed = true;
      }
  }

... But I receive the error 4756 (10013 - invalid request): I've tried many other options but I can't get it to work: can anyone figure out what's wrong?
(The symbol used is "BTCUSD")

Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
Documentation on MQL5: Constants, Enumerations and Structures / Codes of Errors and Warnings / Trade Server Return Codes
  • www.mql5.com
All requests to execute trade operations are sent as a structure of a trade request MqlTradeRequest using function OrderSend() . The function...