OrderSend() slippage parameter, in points or in pips? - page 4

 
@rrsch #: Hm. I'm only using order types OP_BUY and OP_SELL. These are market orders, right? I got error #138 (Off quotes). I see in the documentation "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 order will be opened at the current price and only if the current price lies within the range of price+-slippage." I have no idea what that's trying to tell me, I can't tell if that's relevant to my case or not?

No, I'm not talking about order types. I'm talking about execution policies — Types of Execution - Trading - MetaTrader 4 Help

If you are getting "Off Quotes" error, then it is most probably "Instant" execution policy where the slippage/deviation parameter is taken into consideration.

 
@rrsch #: Those are in use elsewhere in the EA, but the OrderSend function specifically seems to want a "point" value for the slippage parameter... previous comments in this thread clarify what this is for forex pairs, but what that means for indices I'm unsure.

Irrespective of the symbol type, the slippage parameter is always in "points", not "Points". Look at the symbol's contact specifications to see the number of "digits" which indirectly tells you the "point size".

For example, for the following index, the point size is 0.1, given that number of digits is 1 for the symbol.


 
Fernando Carreiro #:

Irrespective of the symbol type, the slippage parameter is always in "points", not "Points". Look at the symbol's contact specifications to see the number of "digits" which indirectly tells you the "point size".

For example, for the following index, the point size is 0.1, given that number of digits is 1 for the symbol.


What is this distinction you made between "points" and "Points" ?

 
Fernando Carreiro #:

No, I'm not talking about order types. I'm talking about execution policies — Types of Execution - Trading - MetaTrader 4 Help

If you are getting "Off Quotes" error, then it is most probably "Instant" execution policy where the slippage/deviation parameter is taken into consideration.

Got it.

The execution type with this broker does appear to be Market.

In that case, any ideas where this error message might have come from? It did occur at a high volatility moment just after US open, and price was jumping around real quick right at my moment of entry, so the idea that it had something to do with slippage makes logical sense, aside from you saying that the slippage parameter doesn't apply to Market executions.

specs

 
Alain Verleyen #:

What is this distinction you made between "points" and "Points" ?

I think he's distinguishing from "Points" being $1 of price movement on, say, the NASDAQ, which is what I was talking about in my previous post.

 
rrsch #:

Got it.

The execution type with this broker does appear to be Market.

In that case, any ideas where this error message might have come from? It did occur at a high volatility moment just after US open, so the idea that it had something to do with slippage makes logical sense, aside from you saying that slippage doesn't apply to Market executions.


Please show your OrderSend() code where you get this error 138.
 
Alain Verleyen #:
Please show your OrderSend() code where you get this error 138.
int slippage   = int( (Ask - Bid) * 2.0 / _Point);

ticket  = OrderSend(_Symbol, orderType, lotSize, currentPrice, slippage, slLinePrice , tpPrice, "OGT", MagicNumber, 0, clrNONE);
 
rrsch #:

Code where you set currentPrice ? It needs to be the last bid/ask depending of the order type.

 
Alain Verleyen #:

Code where you set currentPrice ? It needs to be the last bid/ask depending of the order type.

void set_current_price(double price)
{
   orderType   = direction> 0 ? OP_BUY : OP_SELL;
   price       = direction> 0 ? Ask : Bid;
   currentPrice  = normalize_price(price);
   move_tp(slLinePrice );
}
 
rrsch #:
Well, I will stop to ask chunk of code one by one, MT4 requires a valid price for OrderSend() even on Market execution, you could have to use RefreshRates().
Reason: