Optimize EA over a time window
#property script_show_inputs input int inAddDays = 2; #include <fxsaber\MultiTester\MTTester.mqh> // https://www.mql5.com/ru/code/26132 #define _CS(A) ((!IsStopped()) && (A)) #define PAUSE 200 void Run( const string Settings = NULL ) { while (_CS(!MTTESTER::IsReady())) Sleep(PAUSE); MTTESTER::CloseNotChart(); if (_CS((Settings == NULL) || MTTESTER::SetSettings(Settings))) MTTESTER::ClickStart(false); while (_CS(!MTTESTER::IsReady())) Sleep(PAUSE); } #define DAY (24 * 3600) void OnStart() { Run(); // First for (int i = 0; _CS(i < inAddDays); i++) { string Settings; if (MTTESTER::GetSettings(Settings)) { const datetime FromDate = (datetime)MTTESTER::GetValue(Settings, "FromDate"); MTTESTER::SetValue(Settings, "FromDate", TimeToString(FromDate + DAY, TIME_DATE)); Run(Settings); // Next } } }
Дмитрий #:
https://www.mql5.com/ru/forum/1111/page3678#comment_58610041
Hello. I'm getting some errors when compiling. If you could fix them, that would be great!
Automatic translation was applied by a moderator. On the English forum, please write in English.
Is it possible to make the Strategy Tester to Optimize EA running it automatically multiple times over a range of time windows?
So, instead of picking a static Start and End dates, I want to make the End date = Today, but the Start date to start from 2024.01.01 run my EA backtest and then re-run the same EA backtest, this time starting from 2024.01.02. Since Dates are not visible in the list of optimizable variables with Start/Step/End, how the above can be acheived?
Any help is highly appreciated!