SYMBOL_ORDER_MARKET==true, yet unable to open TRADE_ACTION_DEAL order?

 

Hello

I m using the MetaQuotes Demo server.

This code:

   int symb_order_mode=(int)SymbolInfoInteger(Symb,SYMBOL_ORDER_MODE);
//--- check for market orders (Market Execution)
   if((SYMBOL_ORDER_MARKET&symb_order_mode)==SYMBOL_ORDER_MARKET)
      Print(Symb+": Market orders are allowed (price specification is not required)");

prints "EURUSD: Market orders are allowed (price specification is not required) "


However I am getting an error when trying to open an order with this code (in both terminal and tester):

      MqlTradeRequest   treq={0};
      treq.symbol = Symb;  // Trade symbol
      treq.action = TRADE_ACTION_DEAL;
      treq.type = ORDER_TYPE_BUY;
      treq.type_filling = ORDER_FILLING_FOK;
      treq.volume = 0.1;  // Requested volume for a deal in lots
      treq.magic = UseMagic;
      MqlTradeResult    tres={0};
            
      OrderSend( treq, tres );

This is the error in tester:

2013.05.08 18:36:16    2013.01.01 23:17:40   failed instant buy 0.10 EURUSD at 0.00000 [Invalid stops]

This is the error in terminal:

2013.05.08 18:42:28    Trades    '1438491': failed instant buy 0.10 EURUSD at 0.00000 [Invalid stops]

I am probably doing something wrong but I can not understand what...  Anybody can point me in the right direction please? I used to work with MQL4 but MQL5 is new for me and I obviously having difficulties even with the most basic things... :(

 

I also read this article, where people  seem to have the same problems:

https://www.mql5.com/en/forum/4209

After reading it and especially the comment from Rosh, I probably don't understand the difference between "Market Order" and "instant Order" in the context of MQL5. I understand the difference between them in the context of the terminal (as explained here):

https://www.metatrader5.com/en/terminal/help/trading/general_concept

But i do not see a setting in the OrderSend function which would allow me to tell the server "Use Instant Order, not Market Order". There is only the value

TRADE_ACTION_DEAL

and I already am using it...

Thanks in advance for any help.. I am sure this is something really simple but I am not getting it for the moment... :(

Trying to place a market order, but it fails because of [Invalid stops]. What should I do?
Trying to place a market order, but it fails because of [Invalid stops]. What should I do?
  • www.mql5.com
Market Execution This is a trade order to open a position in the Market Execution mode.
 
encho:

Hello

I m using the MetaQuotes Demo server.

This code:

prints "EURUSD: Market orders are allowed (price specification is not required) "


However I am getting an error when trying to open an order with this code (in both terminal and tester):

This is the error in tester:

2013.05.08 18:36:16    2013.01.01 23:17:40   failed instant buy 0.10 EURUSD at 0.00000 [Invalid stops]

This is the error in terminal:

2013.05.08 18:42:28    Trades    '1438491': failed instant buy 0.10 EURUSD at 0.00000 [Invalid stops]

I am probably doing something wrong but I can not understand what...  Anybody can point me in the right direction please? I used to work with MQL4 but MQL5 is new for me and I obviously having difficulties even with the most basic things... :(

I think you also need to check the Execution Mode:  SYMBOL_TRADE_EXEMODE   also look at this:  trade request  (scroll down a little)
 
encho:

I also read this article, where people  seem to have the same problems:

https://www.mql5.com/en/forum/4209

After reading it and especially the comment from Rosh, I probably don't understand the difference between "Market Order" and "instant Order" in the context of MQL5. I understand the difference between them in the context of the terminal (as explained here):

https://www.metatrader5.com/en/terminal/help/trading/general_concept

But i do not see a setting in the OrderSend function which would allow me to tell the server "Use Instant Order, not Market Order". There is only the value

and I already am using it...

Thanks in advance for any help.. I am sure this is something really simple but I am not getting it for the moment... :(

You can't set trade execution type, it's defined by broker, you have to check what is allowed.

For Instant execution you have to set a price.

 
Thank you people, I will read what RaptorUK suggested and I will try angevoyageur's suggestion to set a price.  Thanks again :)
Reason: