How can an EA recognize that is opened in test mode?

 
I want to add a feature for my EA, but I would like this only in test mode.
 
  1. Why do you care? Other than diagnostics during non-live/non-optimizer modes, you shouldn't be doing anything different.
  2. Test for it.
              Detect optimization mode programmatically - Expert Advisors - MQL5 programming forum (2020)
 
William Roeder #:
  1. Why do you care? Other than diagnostics during non-live/non-optimizer modes, you shouldn't be doing anything different.
  2. Test for it.
              Detect optimization mode programmatically - Expert Advisors - MQL5 programming forum (2020)
Let's say I have a test where trades are open, I want this to be automatically on test mode.
 
Osmar Sandoval Espinosa #:
Let's say I have a test where trades are open, I want this to be automatically on test mode.
Install a second MT5 for development on a different folder when installing. For example click the installer. exe, at some point it will ask where to install mt5 eg mt5 folder, instead of the one suggested add a 1 and click next. Hope that helps
 
Use
MQLInfoInteger (MQL_TESTER)
 
Dr Matthias Hammelsbeck #:
Use
MQLInfoInteger (MQL_TESTER)
if(MQLInfoInteger(MQL_TESTER)) {
//- Hide or show feature. e;g period separator, etc

}