# Efficient optimization of parameters with an intraday timeframe

I'm looking for the most efficient way to code the start, end, and exit parameters optimization for a 1 minute bar. While using the HHMMSS format and stepping by 100 (1 minute) there are many lost optimizations if the optimizing time spans multiple hours (as anything past XX6000 will still step by 100, but will attempt to read the 61st-100th minute of the hour.)
Here's what my code currently is:

Moderator comment: added REQUIRED CODE TAGS

``````StartTimeShort = Optimize("StartTimeShort", 093000, 090000, 104500, 100);
EndTimeShort = Optimize("EndTimeShort", 103000, 093000, 113000, 100);
ExitTimeShort = Optimize("ExitTimeShort", 120000, 094500, 123000, 100);
TimeLogicShort = ExitTimeShort >= EndTimeShort AND EndTimeShort > StartTimeShort; // to somewhat limit inefficiences
``````

There was a similar thread titled " Optimize over time intervals shorter than an hour" in which a very efficient method was created for optimizing a single time parameter:

``````// Do the time optimization
startHours = Optimize("startHours", 4, 0, 15, 1);  // hours
startMinutes = Optimize("startMinutes", 0, 0, 45, 15 );  // minutes
endTime = 160000;  // end in HHMMSS format
startTime = startHours * 10000 + startMinutes * 100;
timeOK = tn >= startTime AND tn <= endTime;
``````

How can I modify this so that it's most efficient for multiple parameters?

You can step minutes and hours separately.

``````StartTimeHours = Optimize("StartTimeHours ", 9, 9, 11, 1);
StartTimeMinutes = Optimize("StartTimeMinutes", 0, 0, 59, 11);

StartTime = StartTimeHours  * 10000 + StartTimeMinutes  * 100;

``````

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.