Download MetaTrader 5
To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
ne0vincent
12
ne0vincent 2016.01.07 22:07 

Hi,

My market orders are never rejected, why ? A position is everytime opened.

(Broker FXPro demo account)

MqlTradeRequest req = {0};
      
req.action = TRADE_ACTION_DEAL;
req.symbol = _Symbol;
req.magic = 1;
req.volume = 0.01;
req.type = ORDER_TYPE_SELL; // --- Buy is also accepted
req.price = 1.9000; // --- Volontary bad price

req.type_filling = ORDER_FILLING_IOC
req.deviation = 0; // --- No deviation, only exact price

MqlTradeResult res={0};
      
if(!OrderSendAsync(req,res))
{
   Print(__FUNCTION__,": error ",GetLastError(),", retcode = ",res.retcode);
}

Thanks a lot :-)

Alain Verleyen
Moderator
28633
Alain Verleyen 2016.01.08 00:37  
ne0vincent:

Hi,

My market orders are never rejected, why ? A position is everytime opened.

(Broker FXPro demo account)

Thanks a lot :-)

VVhy not ? Market execution type don't need a price. Deviation is never taken into account on a demo account, and is useless on Market execution.
/
To add comments, please log in or register