I mean whenever I will launch the MT5 it should show exactly 1 month gap between "FromDate" and "ToDate" starting from today. ToDate should always be updated automatically to today's date.
You're on the right track with a .ini file, but don't use common.ini.
1. Generate your own .ini file with the correct dates in it.
2. Then launch MT5 using a command line parameter that points to this .ini file. For example:
"C:\Program Files\MetaTrader 5\terminal64.exe" /config:"C:\Users\me\AppData\Roaming\MetaQuotes\Terminal\D0E123F57C8CF37AD8BF550E51FF075\MQL5\myconfiguration1.ini"
I have successfully done these two steps in python, outside MT5.
FxTrader562:
Is there a way to do it using MQL5 language?
I'm not sure if it can be done from within MQL5 code because you would need terminal64.exe running to execute that code, then have it reload terminal64.exe through the command line . . . well, it could get messy. Maybe it could be done.
You're on the right track with a .ini file, but don't use common.ini.
1. Generate your own .ini file with the correct dates in it.
2. Then launch MT5 using a command line parameter that points to this .ini file. For example:
I have successfully done these two steps in python, outside MT5.
I'm not sure if it can be done from within MQL5 code because you would need terminal64.exe running to execute that code, then have it reload terminal64.exe through the command line . . . well, it could get messy. Maybe it could be done.
Thanks you for your reply.
I can easily launch the terminal by a task scheduler and so that is not a problem. I just want the dates to be set automatically by MQL5 language which I can write inside an EA code and let it run on the same MT5 terminal. So whenever the MT5 terminal will be launched the EA will set the FromDate and ToDate automatically. So is that possible and what is the code for it?
I know people have done it in Auto_optimisation thread to launch the MT5 terminal and optimise the EA by itself. But I am just looking for settings the dates. That's all and hence, I am sure it is possible..But I just don't know.
I know the code lies here in the article, what to use still I can't figure out:
https://www.mql5.com/ru/articles/4917
- www.mql5.com
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to know how can I change the FromDate and ToDate of the strategy tester using MQL5?
I mean whenever I will launch the MT5 it should show exactly 1 month gap between "FromDate" and "ToDate" starting from today. ToDate should always be updated automatically to today's date. Is there a way to do it using MQL5 language?
I guess it should be possible and it should be probably a few lines of code to achieve it, but I just don't know how to do it. I tried to change it in the "common.ini" file, but it doesn't seem to affect the MT5 terminal dates upon MT5 restart. Hence, I didn't attempt to write the code.
If somehow I can change the settings inside the "common.ini" file or any such settings file using an EA by writing into that file, then I guess after the MT5 launch it should automatically change the dates after the first tick or upon the EA initialisation.
Any help in this regard will be highly appreciated. I have attached a screenshot to explain what I am trying to achieve using MQL5.