Resolve issue where OR levels were not updated correctly if using non-time based bars and regular trading hours

This commit is contained in:
moshferatu 2023-03-06 06:34:37 -08:00
parent 5b6c31ecfc
commit a4cfe65a4e

View File

@ -108,6 +108,13 @@ namespace NinjaTrader.NinjaScript.Indicators
DateTime marketOpen = now.Date + Session.GetTradingDayBeginLocal(Session.ActualTradingDayExchange).TimeOfDay;
DateTime marketClose = now.Date + Session.GetTradingDayEndLocal(Session.ActualTradingDayExchange).TimeOfDay;
if (now.Date != OpeningRangeDate)
{
OpeningRangeHigh = 0.0;
OpeningRangeLow = 0.0;
OpeningRangeMid = 0.0;
}
if (BarsInProgress == 0)
{
ORH[0] = OpeningRangeHigh;
@ -132,13 +139,6 @@ namespace NinjaTrader.NinjaScript.Indicators
OpeningRangeMidStroke.Brush, OpeningRangeMidStroke.DashStyleHelper, (int)OpeningRangeMidStroke.Width);
}
if (now >= marketClose)
{
OpeningRangeHigh = 0.0;
OpeningRangeLow = 0.0;
OpeningRangeMid = 0.0;
}
return;
}