Is there any way to know if the EA is running on Strategy Tester?
My EA uses the symbolInfo.MarginMaintenance() to make some equations to trade but these values are zero in strategy tester. To work around this problem, I created a parameter to set the margin (to use in strategy tester only) and I want to ignore this parameter when the EA runs on demo and real accounts.
Can someone help me to solve this problem?
Yes.
if (MqlInfoInteger(MQL_TESTER)) { printf("*** tester"); }
There's also a visual mode property ...
https://www.mql5.com/en/docs/check/mqlinfointeger
- www.mql5.com
Is there any way to know if the EA is running on Strategy Tester?
My EA uses the symbolInfo.MarginMaintenance() to make some equations to trade but these values are zero in strategy tester. To work around this problem, I created a parameter to set the margin (to use in strategy tester only) and I want to ignore this parameter when the EA runs on demo and real accounts.
Can someone help me to solve this problem?
And for MT4, it's:
IsTesting()
https://docs.mql4.com/check/istesting
I get this error while compiling !?
'MqlInfoInteger' - undeclared identifier
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. We can't see your broken code.
Did you bother to read the documentation?
Checkup
/ MQLInfoInteger - Reference on algorithmic/automated trading language for MetaTrader 5
MQLInfoInteger
- MQL4 Reference
enum termnal_Mode{ MODE_DEBUG, MODE_LIVE, MODE_VISUAL, MODE_OPTIMIZER}; termnal_Mode get_modus_operandi(void){ if(IS_DEBUG_MODE) return MODE_DEBUG; // Live but debugging. if(!IsTesting() ) return MODE_LIVE; if( IsVisualMode() ) return MODE_VISUAL; return MODE_OPTIMIZER;For MT4
Do you really expect an answer? There are no mind readers here and our crystal balls are cracked. We can't see your broken code.
Did you bother to read the documentation?
Checkup / MQLInfoInteger - Reference on algorithmic/automated trading language for MetaTrader 5
MQLInfoInteger - MQL4 Reference
Yes, I could not see any hint in documenation to import or only use it within a specific scope. So what's the trick?
If I use this line in OnInti() or in any other method I tried, it does not compile.
if (MqlInfoInteger(MQL_TESTER)) { printf("*** tester"); }
Ah, the example above is just wrong!
It is:
if (MQLInfoInteger(MQL_TESTER))
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there any way to know if the EA is running on Strategy Tester?
My EA uses the symbolInfo.MarginMaintenance() to make some equations to trade but these values are zero in strategy tester. To work around this problem, I created a parameter to set the margin (to use in strategy tester only) and I want to ignore this parameter when the EA runs on demo and real accounts.
Can someone help me to solve this problem?