PureBytes Links
Trading Reference Links
|
foolsgold wrote:
> Can someone help with an example of code for optimizing time
> so I don't optimize times like 9:60 9:70 9:80 etc.
You need to use offsets in minutes, rather than trying to optimize the
"time" format directly.
In other words, if you try to optimize from 930 to 1100 by 10, you'll hit those
invalid values like 960.
If you instead optimize from, say, 0 to 90 by 10, then you can use code like
this:
inputs: MinDelay(0);
var: StartTime(0);
StartTime = MinutesToTime(TimeToMinutes(Sess1StartTime)+MinDelay);
TimeToMinutes converts the HHMM Time format to a minute offset from
midnight, if I remember right. (I'm not at my TS now so I can't look it up,
but it doesn't really matter for this example.) Then you add the MinDelay
offset to the Sess1StartTime minutes value, and use MinutesToTime to
convert the resulting minutes value back to HHMM Time format.
StartTime will then reflect a Time value that is MinDelay minutes after the
start of the session.
Gary
|