Slippage Question

 

Slippage seems easy enough to understand but I'm obviously getting something wrong.

 

 I set Ask to a variable, send a buy order with slippage value 0 or 1, great.

Then compare my stated price with the OrderOpenPrice and they are different by 2 points... and this keeps happening.

 

i.e. something like:

       double askprice = Ask;

      int Ticket = OrderSend(symb,OP_BUY,1,askprice,1,0.0,0.0,"hello",100,0,CLR_NONE);

      OrderSelect(Ticket,SELECT_BY_TICKET);

      Alert("my price:",DoubleToStr(askprice,5),"   order price:",DoubleToStr(OrderOpenPrice(),5));

 so how come the alert is sometimes like:

my price:1.33061   order price:1.33059

 
alladir:

Slippage seems easy enough to understand but I'm obviously getting something wrong.

 

 I set Ask to a variable, send a buy order with slippage value 0 or 1, great.

Then compare my stated price with the OrderOpenPrice and they are different by 2 points... and this keeps happening.

 

i.e. something like:

 so how come the alert is sometimes like:

my price:1.33061   order price:1.33059

Perhaps it is related to this:  https://www.mql5.com/en/forum/143997/page2#773665  it makes slippage redundant.
 
RaptorUK:
Perhaps it is related to this:  https://www.mql5.com/en/forum/143997/page2#773665  it makes slippage redundant.


    : 0

 

 

 Wow.... thanks for that.. so glad I asked this one rather than pondering it myself for hours.... can't believe it but it's true.

 

Actually this is really annoying, I'm writing a script that sets the stoploss based at the price I drop the script on, and it calculates the Lots to risk no more than a set % of my balance.

I did everything "right" in terms of the documentation but with high lots and small price changes I was sometimes losing near double my limit... because slippage is seemingly unlimited?

 

Kind of despairing here.. I guess its something we just have to live with..? 

 
alladir:


    : 0

 Wow.... thanks for that.. so glad I asked this one rather than pondering it myself for hours.... can't believe it but it's true.

Did you test it on your terminal ?
 
Yes, order goes through with any price value... Ill try with a few brokers
 
alladir:
Yes, order goes through with any price value... Ill try with a few brokers

You should ask your Broker and quote this from the OrderSend() documentation  . . .

At opening of a market order (OP_SELL or OP_BUY), only the latest prices of Bid (for selling) or Ask (for buying) can be used as open price. If operation is performed with a security differing from the current one, the MarketInfo() function must be used with MODE_BID or MODE_ASK parameter for the latest quotes for this security to be obtained. Calculated or unnormalized price cannot be applied. If there has not been the requested open price in the price thread or it has not been normalized according to the amount of digits after decimal point, the error 129 (ERR_INVALID_PRICE) will be generated. If the requested open price is fully out of date, the error 138 (ERR_REQUOTE) will be generated independently on the slippage parameter. If the requested price is out of date, but present in the thread, the position will be opened at the current price and only if the current price lies within the range of price+-slippage.

 
RaptorUK:

You should ask your Broker and quote this from the OrderSend() documentation  . . .



I tried the same script with OrderSent using price = 0 on 8 brokers with demo accounts. It opened on order on 3 of them, the other 5 say invalid price.

Also, I tried my script at work today (with a slow internet connection) and entered a trade with slippage = 86!  Horrific. Scary. And no way to avoid it.

 
alladir:


I tried the same script with OrderSent using price = 0 on 8 brokers with demo accounts. It opened on order on 3 of them, the other 5 say invalid price.

Also, I tried my script at work today (with a slow internet connection) and entered a trade with slippage = 86!  Horrific. Scary. And no way to avoid it.

Please do me a favour,  submit a Service Desk request asking to explain this behaviour . . .  my interpretation is that this behaviour is contra the mql4 Documentation,  I raised a Service Desk Ticket on the 18th March and have had no reply, perhaps you will fare better.
 
RaptorUK:
Please do me a favour,  submit a Service Desk request asking to explain this behaviour . . .  my interpretation is that this behaviour is contra the mql4 Documentation,  I raised a Service Desk Ticket on the 18th March and have had no reply, perhaps you will fare better.

Did you tried an email ?
 
angevoyageur:
Did you tried an email ?
Maybe I should indeed take my own advice