you see 3 ranges because it’s over 3 days. But yea it’s quite a lazy addition but better than nothing.
Just write create indicator that takes 4 x DateTime user inputs and draws 4 highlights. Put this in SetDefaults x 4:
StartTime1 = DateTime.Parse("09:30", System.Globalization.CultureInfo.InvariantCulture);
EndTime1 = DateTime.Parse("16:00", System.Globalization.CultureInfo.InvariantCulture);
put this after/outside the OnBarUpdate Section x 4 (changing the numbers obviously):
// StartTime1
[PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")]
[Display(Name="StartTime1", Description="", Order=10, GroupName="Parameters")]
public DateTime StartTime1
{ get; set; }
// EndTime1
[PropertyEditor("NinjaTrader.Gui.Tools.TimeEditorKey")]
[Display(Name="EndTime1", Description="", Order=20, GroupName="Parameters")]
public DateTime EndTime1
{ get; set; }
Then put this inside onBarUpdate x 4:
Draw.RegionHighlightX(this, "MyHighlight1", StartTime1, EndTime1, Brushes.Green, Brushes.Blue, 50)
This should update the times everyday and draws 4 highlights. Adjust colours accordingly.
Be aware NT doesn’t like drawing anything in the future on Tick Charts. You would have to reload Ninjascript a lot.