Well, what DOES it do then? Is this the whole code? What value is Expire time?
Tobias Johannes Zimmer #:
Well, what DOES it do then? Is this the whole code? What value is Expire time?
Well, what DOES it do then? Is this the whole code? What value is Expire time?
It wasn't the whole code. it the part that doesn't work as expected. btw, I found the answer.
This is the correct line of code to achieve that.
datetime ExpireTime = __DATETIME__ + PeriodSeconds(PERIOD_D1) *30 // 30d from the compiled date string ExpireMsg = "The EA has been expired since" + TimeToString(ExpireTime,TIME_DATE|TIME_MINUTES); // OnInt function --------+++++ ----------- int OnInit() { if(TimeCurrent() < ExpireTime) // Not Expired { if(MQLInfoInteger(MQL_TESTER) == true) // Check the EA is on the strategy tester. { return(INIT_SUCCEEDED); } else { PlaySound("Alert.wav"); MessageBox("This is a Demo version. Only works on the \"Strategy Tester\". Purchase the \"Paid Version\" to unlock the Expert Advisor. ","Invalid Chart",MB_OK); return(INIT_FAILED); } } else { PlaySound("Alert.wav"); MessageBox(ExpireMsg,"Expired...!",MB_OK); return(INIT_FAILED); } }
You can simply use this:
if(MQLInfoInteger(MQL_TESTER)==true) // do things in test mode...

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I need to create a custom Demo version for my EA., so I used the OnTesterInt(); function and update a flag if the EA was loaded to strategy tester. but the code doesn't works as expected. What I did wrong here?.