I m using the MetaQuotes Demo server.
//--- check for market orders (Market Execution)
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):
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;
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:
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):
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.