How do you handle hidden broker slippage inside your MQL5 code?

 
Hello coders! My Expert Advisor performs perfectly in the MetaTrader Strategy Tester, but when I deploy it live, slippage eats up all my profits. What are your favorite MQL5 tricks to detect and handle high slippage before an order is executed? Do you check the spread dynamically, or do you use strict deviation filters?"
 
Syed Jawad Hussain Naqvi:
Hello coders! My Expert Advisor performs perfectly in the MetaTrader Strategy Tester, but when I deploy it live, slippage eats up all my profits. What are your favorite MQL5 tricks to detect and handle high slippage before an order is executed? Do you check the spread dynamically, or do you use strict deviation filters?"

you need to provide evidence of such slippage. But i think that what you have called slippage is not slippage. If your signals get different prices in strategy tester than it does on live trading, then, your coding is most likely the cause. And there can be many possible reasons for it, And there is not enuf space in this thread for us to mention them all. Only way to help you would be to see your code and then we can give advice. Your term that you have used as "slippage" is only a general use. you need to be more specific with your description so we can identify your issue. Remember that this is a technical forum.

We have 3 favorite sayings: we can not see your screen, we can not read your mind, and the most common fav is "our crystal balls are cracked and broken".

 
Michael Charles Schefe #:

you need to provide evidence of such slippage. But i think that what you have called slippage is not slippage. If your signals get different prices in strategy tester than it does on live trading, then, your coding is most likely the cause. And there can be many possible reasons for it, And there is not enuf space in this thread for us to mention them all. Only way to help you would be to see your code and then we can give advice. Your term that you have used as "slippage" is only a general use. you need to be more specific with your description so we can identify your issue. Remember that this is a technical forum.

We have 3 favorite sayings: we can not see your screen, we can not read your mind, and the most common fav is "our crystal balls are cracked and broken".

Hmm Great Explanation
 
Syed Jawad Hussain Naqvi:
Hello coders! My Expert Advisor performs perfectly in the MetaTrader Strategy Tester, but when I deploy it live, slippage eats up all my profits. What are your favorite MQL5 tricks to detect and handle high slippage before an order is executed? Do you check the spread dynamically, or do you use strict deviation filters?"
If the cause of your perceived slippage is not your code, the cause is simply the difference between "always ideal" simulated execution in the Tester versus live execution at prices that are actually available in the real world. If that is your case, your only fix is a new strategy that isn't so "scalpy."