diff --git a/indicators/OpeningRange.cs b/indicators/OpeningRange.cs index 786064a..fa1e2ed 100644 --- a/indicators/OpeningRange.cs +++ b/indicators/OpeningRange.cs @@ -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; }