Order Send error 138 ? - page 2

 
Daniel Cioca #:

You are obviously right.

What I was saying is to retry OrderSend with the latest prices. Also maybe include IsTradeContextBusy() maybe..it also help to speedup filling requested order.

Because, as he is saying, he is only getting this error sometimes, not every time.

What does isTradeContextBusy() do ?, and can error 138 occur when I try to send multiple orders from different pairs at the same time ?

 
Fernando Carreiro #:

Retrying the OrderSend() with the same parameters is a waste of time and effort for a Requote. Obviously if it is a requote, then the market prices have changed and drifted too far away from the maximum deviation specified by the user. The parameters for the order are no longer valid and have to be recalculated and the conditions reevaluated to see if they still make sense according to the strategy rules or not, and only then resubmit the order under the new parameters and conditions.

Is my maximum standard deviation my slippage value ?, if so 

extern int SLIPPAGEINT = 2;
int SLIPPAGE = int((SLIPPAGEINT * (Ask - Bid)) / _Point);

This is my code for slippage, could this be the reason I get order send error 138 ? 

 
George Johnson #:

What does isTradeContextBusy() do ?, and can error 138 occur when I try to send multiple orders from different pairs at the same time ?

yes it might...as if it is busy it will delay to fill your order with the prices already set ... and with slippage... eliminate it and test...just to see if without slippage  you still have that error... try it also with a different broker

 
Daniel Cioca #:

yes it might...as if it is busy it will delay to fill your order with the prices already set ... and with slippage... eliminate it and test...just to see if without slippage  you still have that error... try it also with a different broker

Hi, thanks for the response, so I should make slippage = 0 ?

 
George Johnson #:

Hi, thanks for the response, so I should make slippage = 0 ?

Yes… try 
Reason: