From 2721851e4f5c850d458d89e155fc0e39dd566a3b Mon Sep 17 00:00:00 2001 From: moshferatu Date: Mon, 1 Jul 2024 16:11:37 -0700 Subject: [PATCH] Remove NinjaScriptProperty attributes from 3CR strokes as they should not be included in the indicator constructor --- indicators/ThreeCandleReversal.cs | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/indicators/ThreeCandleReversal.cs b/indicators/ThreeCandleReversal.cs index 87edcb0..5ba1a2f 100644 --- a/indicators/ThreeCandleReversal.cs +++ b/indicators/ThreeCandleReversal.cs @@ -182,12 +182,10 @@ namespace NinjaTrader.NinjaScript.Indicators [Display(Name = "Bar Lookback", Description = "Number of bars to compare for detecting swing highs / lows", Order = 1, GroupName = "3CR")] public int BarLookback { get; set; } - [NinjaScriptProperty] [XmlIgnore] [Display(Name = "Bullish Level", Description = "Stroke for bullish level drawn on chart", Order = 2, GroupName = "3CR")] public Stroke BullishLevelStroke { get; set; } - [NinjaScriptProperty] [XmlIgnore] [Display(Name = "Bearish Level", Description = "Stroke for bearish level drawn on chart", Order = 3, GroupName = "3CR")] public Stroke BearishLevelStroke { get; set; } @@ -201,18 +199,18 @@ namespace NinjaTrader.NinjaScript.Indicators public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private ThreeCandleReversal[] cacheThreeCandleReversal; - public ThreeCandleReversal ThreeCandleReversal(int barLookback, Stroke bullishLevelStroke, Stroke bearishLevelStroke) + public ThreeCandleReversal ThreeCandleReversal(int barLookback) { - return ThreeCandleReversal(Input, barLookback, bullishLevelStroke, bearishLevelStroke); + return ThreeCandleReversal(Input, barLookback); } - public ThreeCandleReversal ThreeCandleReversal(ISeries input, int barLookback, Stroke bullishLevelStroke, Stroke bearishLevelStroke) + public ThreeCandleReversal ThreeCandleReversal(ISeries input, int barLookback) { if (cacheThreeCandleReversal != null) for (int idx = 0; idx < cacheThreeCandleReversal.Length; idx++) - if (cacheThreeCandleReversal[idx] != null && cacheThreeCandleReversal[idx].BarLookback == barLookback && cacheThreeCandleReversal[idx].BullishLevelStroke == bullishLevelStroke && cacheThreeCandleReversal[idx].BearishLevelStroke == bearishLevelStroke && cacheThreeCandleReversal[idx].EqualsInput(input)) + if (cacheThreeCandleReversal[idx] != null && cacheThreeCandleReversal[idx].BarLookback == barLookback && cacheThreeCandleReversal[idx].EqualsInput(input)) return cacheThreeCandleReversal[idx]; - return CacheIndicator(new ThreeCandleReversal(){ BarLookback = barLookback, BullishLevelStroke = bullishLevelStroke, BearishLevelStroke = bearishLevelStroke }, input, ref cacheThreeCandleReversal); + return CacheIndicator(new ThreeCandleReversal(){ BarLookback = barLookback }, input, ref cacheThreeCandleReversal); } } } @@ -221,14 +219,14 @@ namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { - public Indicators.ThreeCandleReversal ThreeCandleReversal(int barLookback, Stroke bullishLevelStroke, Stroke bearishLevelStroke) + public Indicators.ThreeCandleReversal ThreeCandleReversal(int barLookback) { - return indicator.ThreeCandleReversal(Input, barLookback, bullishLevelStroke, bearishLevelStroke); + return indicator.ThreeCandleReversal(Input, barLookback); } - public Indicators.ThreeCandleReversal ThreeCandleReversal(ISeries input , int barLookback, Stroke bullishLevelStroke, Stroke bearishLevelStroke) + public Indicators.ThreeCandleReversal ThreeCandleReversal(ISeries input , int barLookback) { - return indicator.ThreeCandleReversal(input, barLookback, bullishLevelStroke, bearishLevelStroke); + return indicator.ThreeCandleReversal(input, barLookback); } } } @@ -237,14 +235,14 @@ namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { - public Indicators.ThreeCandleReversal ThreeCandleReversal(int barLookback, Stroke bullishLevelStroke, Stroke bearishLevelStroke) + public Indicators.ThreeCandleReversal ThreeCandleReversal(int barLookback) { - return indicator.ThreeCandleReversal(Input, barLookback, bullishLevelStroke, bearishLevelStroke); + return indicator.ThreeCandleReversal(Input, barLookback); } - public Indicators.ThreeCandleReversal ThreeCandleReversal(ISeries input , int barLookback, Stroke bullishLevelStroke, Stroke bearishLevelStroke) + public Indicators.ThreeCandleReversal ThreeCandleReversal(ISeries input , int barLookback) { - return indicator.ThreeCandleReversal(input, barLookback, bullishLevelStroke, bearishLevelStroke); + return indicator.ThreeCandleReversal(input, barLookback); } } }