Multiple time filtering with an array would likely lead to an overfitted and unusable strategy.

Optimizing a start time and a time window is better, but I would use time filters with extreme caution - they can let any losing system appear profitable in the backtest. Anyway, for optimizing something that can be 0 or negative, just subtract a constant value like this:

int start_hour = optimize(1,1,24,1)-1;