My thought was to put the time of the optimization in a GlobalVariable, and let each optimization run look to see if there such a GlobalVariable, and if yes, use the numeric value of that GlobalVariable, and if not, generate it.
However, this does not seem to work, since each optimization run can't read/find/use the GlobalVariable.
With this code:
Code: Select all
Variables:
backtestTimeGV(0), gvName("");
backtestTimeGV = el_datetodatetime(CurrentDate) + el_timetodatetime_s(CurrentTime_s);
gvName = Text(GetStrategyName, "test");
Print(TimeNow, "backTestTimeGV: ", FormatTime("HH:mm:ss", GVGetNamedDouble(gvName, 0)));
// If the global variable does not exist, set it to the current time
if (GVGetNamedDouble(gvName, 0) = 0) then
value75 = GVSetNamedDouble(gvName, backtestTimeGV)
// If it does exist, use the value of the global variable
else
backtestTimeGV = GVGetNamedDouble(gvName, 0);
Print(Spaces(3), "backTestTimeGV after: ", FormatTime("HH:mm:ss", backtestTimeGV),
Spaces(3), "GlobalVariable value: ", FormatTime("HH:mm:ss", GVGetNamedDouble(gvName, 0)));
Thanks in advance for any suggestions06-12_07:20:10 backTestTimeGV: 00:00:00
backTestTimeGV after: 07:20:10 GlobalVariable value: 07:20:10
06-12_07:20:10 backTestTimeGV: 07:20:10
backTestTimeGV after: 07:20:10 GlobalVariable value: 07:20:10
06-12_07:20:10 backTestTimeGV: 07:20:10
backTestTimeGV after: 07:20:10 GlobalVariable value: 07:20:10
06-12_07:20:10 backTestTimeGV: 07:20:10
backTestTimeGV after: 07:20:10 GlobalVariable value: 07:20:10
06-12_07:20:11 backTestTimeGV: 00:00:00
06-12_07:20:11 backTestTimeGV: 00:00:00
backTestTimeGV after: 07:20:11 GlobalVariable value: 07:20:11
06-12_07:20:11 backTestTimeGV: 07:20:11
backTestTimeGV after: 07:20:11 GlobalVariable value: 07:20:11
06-12_07:20:11 backTestTimeGV: 07:20:11
backTestTimeGV after: 07:20:11 GlobalVariable value: 07:20:11
backTestTimeGV after: 07:20:11 GlobalVariable value: 07:20:11
06-12_07:20:13 backTestTimeGV: 00:00:00
backTestTimeGV after: 07:20:13 GlobalVariable value: 07:20:13
06-12_07:20:13 backTestTimeGV: 07:20:13
06-12_07:20:13 backTestTimeGV: 07:20:13
06-12_07:20:13 backTestTimeGV: 07:20:13
backTestTimeGV after: 07:20:13 GlobalVariable value: 07:20:13
backTestTimeGV after: 07:20:13 GlobalVariable value: 07:20:13
backTestTimeGV after: 07:20:13 GlobalVariable value: 07:20:13
06-12_07:20:14 backTestTimeGV: 00:00:00
06-12_07:20:14 backTestTimeGV: 00:00:00
06-12_07:20:14 backTestTimeGV: 00:00:00
06-12_07:20:14 backTestTimeGV: 07:20:14
Regards,
Josh