MaxSlippage allows you to limit your exposure when your order is slipped by more than you’re willing to accept. It compares your entry price to the price value at the beginning of the spike. If your entry deviates more than what is defined in MaxSlippage, the EA automatically tightens your SL to the closest value that your broker accepts. You can widen the stop based on that level by using the MaxSlippageDistance value. This allows you to choose a wider stop loss level.
Example 1:
MaxSlippage=10 MaxSlippageDistance=0
You receive a buy signal on USD/JPY with the spike start at 100.00 . Your broker slips you 14 pips on your order is opened at 100.14. The difference is higher than the value defined in MaxSlippage and thus, MaxSlippage is activated. MaxSlippageDistance is set to 0. The EA will choose the tightest SL possible. Your broker allows SL as close as 2 pips to the current price. Therefore, your SL is set to 100.12.
Example 2:
MaxSlippage=12 MaxSlippageDistance=4
You receive a sell signal on GBP/USD with the spike start at 1.3795 . Your broker slips you 24 pips on your order is opened at 1.3771. The difference is higher than the value defined in MaxSlippage and thus, MaxSlippage is activated. MaxSlippageDistance is set to 4. The EA will place your SL 4 pips below the tightest SL value. Your broker allows SL as close as 0 pips to the current price. Therefore, your SL is set to 1.3775.