simulate slippage and re quotes in system

 

I am trying to simulate slip by 

 I change the  delay setting from 0 ~500 ms , the result always between 0.00000 ~ 0.00003 ? It's far from real world trade with broker. EURUSD,2020/01~2020/04

Is any thing I miss?

MqlTradeRequest      Request = {0};
MqlTradeResult       Results = {0};
Request.deviation = 15;

if(rand() < 16384){
Request.price = SymbolInfoDouble(Symbol(), SYMBOL_ASK);
Request.type = ORDER_TYPE_BUY;
}

if(OrderSend(Request, Results){
  buy_slip = (Results.price - Request.price);
  sell_slip = (Request.price - Results.price);
    Print(Request.type, " OrderID: ",Results.order," slip", DoubleToString(buy_slip *10000,1)
     );
}{
  buy_slip = (Results.price - Request.price);
  sell_slip = (Request.price - Results.price);
   Print(Request.type, "Failed OrderID: ",Results.order," slip", DoubleToString(buy_slip *10000,1)
     );
}
 
SungSungE: Is any thing I miss?
if(OrderSend(Request, Results){
  ⋮
}{
  buy_slip = (Results.price - Request.price);
  sell_slip = (Request.price - Results.price);
   Print(Request.type, "Failed OrderID: ",Results.order," slip", DoubleToString(buy_slip *10000,1)
     );
}

You are executing that code whether the send succeeds or not.

 
William Roeder:

You are executing that code whether the send succeeds or not.

Can't get your ideal ?

Actual code use timer trigger each new orders.  

if(OrderSend(Request, Results){
send success print out

}else{
send failed print out

}