I have code that opens a trade at 080000, and I’d like to see whether 080500, 081000 etc is better, ie I’d like to be able to optimise a time variable during the variable optimisation. I’ve tried putting times like 080500 into the ‘Cable in program’ box in the Definition of Variables dialogue box, but with no success.
Is it possible to do this, and if so, how?
Thanks
Try 000000 230000 010000 in the Optimiser to optimise to nearest 1 hour then narrow it down to nearest 1 minute etc.
Time = xx
OR
Hour = xx
and enter … 0 23 1 in the optimiser
I got it working. Thank you for that.
Hi,
I’ve the same problem. Can you share the code please?
thank you!
For Time >= xxxxxx
Try min = 000000 max = 230000 and step = 010000 (in the Optimiser to optimise to nearest 1 hour then narrow it down to nearest 1 minute etc).
For Hour = xx
Try min = 0 max = 23 step = 1 (in the optimiser)
If you need more explanation, just say which bit you don’t understand?
Code could be something like either of below …
If Time >= 080000 Then
Buy at Market
Endif
If Hour = 140000 Then
Buy at Market
Endif
Hour = xx code should read as below
If Hour = 14 Then
Buy at Market
Endif
so, the time will be 10000, 20000 etc
Above is okay, so 10000 is 1 am in the morning. The Optimiser disregards leading 00’s, but it still works as a variable value in the code.
0 is also okay as that is midnight (000000).
We are
kidding the Optimiser into working for us! 😉