I'm using the NT "CurrentDayOHL" indicator to trade futures, but would like the High and Low of the indicator to be based on the 8:30 am market open and not the HL for the start of the day.
I tried making the following changes to the script, but I'm stuck figuring out where I went wrong.
Thanks in advance.
OnBarUpdate ()
if (currentDate != Bars.GetTradingDayFromLocal(Time[0]) || currentOpen == double.MinValue)
{
currentOpen = Open[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
currentHigh = High[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
currentLow = Low[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
sameDay = false;
}
currentHigh = Math.Max(currentHigh, High[0]);
currentLow = Math.Min(currentLow, Low[0]);
if(ToTime(Time[0]) < ToTime(8,30,0))
{
currentOpen = Open[0];
currentHigh = High[0];
currentLow = Low[0];
PlotColors[0][0] = Color.Transparent;
}
if(currentDate == Bars.GetTradingDayFromLocal(Time[0]) && ToTime(Time[0]) >= ToTime(8,30,0))
currentOpen = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
currentHigh = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
currentLow = Close[CurrentBar-Bars.GetBar(new DateTime(Time[0].Year,Time[0].Month,Time[0].Day,8,30,0))];
Comment