Slippage adjustment for 5digit brokers.

To add comments, please log in or register
Tom Clayson
215
Tom Clayson  
When passing values for slippage into OrderClose do adjustments need to be made for brokers with different digits? So for a four digit broker I would pass '3' for example, but for a five digits this would be '30'?
Brian Dee - Random Trader
1758
Brian Dee - Random Trader  

WBC
Thats correct

void HandleDigits()
{
    // Automatically handles full-pip and sub-pip accounts
    if (Digits == 4 || Digits == 2) 
     {
       
       Real.Slippage = Slippage;

     }
  
   if (Digits == 5 || Digits == 3) 
     {
       
       Real.Slippage = Slippage*10;

     }

}


Use Real.Slippage in your OrderSend
Good Luck
-BB-

Brian Dee - Random Trader
1758
Brian Dee - Random Trader  

Of course if your EA is multi-currency, you would use MarketInfo to get the digits of the pair of interest if its not the chart pair
Just because the broker is 'sub-pip' does not guarantee all pairs are quoted in sub-pips...
In particular, where a broker has changed their minimum MODE_LOTSTEP, you may have a mixture of full & sub-pip pairs...
FWIW
-BB-

To add comments, please log in or register