From ca7f284332ca626bb79c601683e77a17a304ef80 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Wed, 7 Feb 2024 12:08:49 -0800 Subject: [PATCH] Handle cases where the current bar's close is exactly equal to the linear regression --- indicators/LinearRegression.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indicators/LinearRegression.cs b/indicators/LinearRegression.cs index febb24b..0aaedd1 100644 --- a/indicators/LinearRegression.cs +++ b/indicators/LinearRegression.cs @@ -66,6 +66,12 @@ namespace NinjaTrader.NinjaScript.Indicators BarBrushes[0] = BelowThresholdColor; CandleOutlineBrushes[0] = BelowThresholdColor; } + else + { + // Handle the rare occasion where the close is equivalent to the linear regression at this bar. + BarBrushes[0] = BarBrushes[1]; + CandleOutlineBrushes[0] = CandleOutlineBrushes[1]; + } } }