Block EA from running on strategy tester
Here is the simple EA code which gives an Alert when initialized on the chart..
int OnInit()
{
Alert("The EA is Initialized");
return(INIT_SUCCEEDED);
}
I want to lock this EA to not run its code on strategy tester. How can I do that?
Thanks & Regards
Naren
int OnInit() { if(IsTesting()) { Alert("..."); return(INIT_FAILED); } return(INIT_SUCCEEDED); }
Hi
Thank you so much for your answer... You made my work simple :-)
so Here is the code to block EA to not run on strategy tester
int OnInit()
{
int A = IsTesting();
if(A != 1)
Alert("EA is Initialized");
return(INIT_SUCCEEDED);
}
Hi Thank you so much for your answer :-)
why you like to do this?
int OnInit(){ int A = IsTesting(); if(A != 1) Alert("EA is Initialized"); return(INIT_SUCCEEDED); }
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - IsTesting does not return an int. Your code doesn't block anything. It only Alerts if you are
using the tester or optimizer but not the debugger or live trading.
Write logging data to text file? - MQL5 programming forum #3 20.04.21
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - IsTesting does not return an int. Your code doesn't block anything. It only Alerts if you
are using the tester or optimizer but not the debugger or live trading.
Write logging data to text file? - MQL5 programming forum #3 20.04.21
Thank you for your reply and suggestions..
Will follow it...
Here is the simple EA code which gives an Alert when initialized on the chart..
int OnInit()
{
Alert("The EA is Initialized");
return(INIT_SUCCEEDED);
}
I want to lock this EA to not run its code on strategy tester. How can I do that?
Thanks & Regards
Naren