diff --git a/indicators/ThreeCandleReversal.cs b/indicators/ThreeCandleReversal.cs index d667e4e..34c6e7c 100644 --- a/indicators/ThreeCandleReversal.cs +++ b/indicators/ThreeCandleReversal.cs @@ -45,6 +45,7 @@ namespace NinjaTrader.NinjaScript.Indicators BarLookback = 5; BullishLevelStroke = new Stroke(Brushes.LimeGreen, DashStyleHelper.Solid, 2); BearishLevelStroke = new Stroke(Brushes.Red, DashStyleHelper.Solid, 2); + MaxPatterns = 0; } if (State == State.DataLoaded) { @@ -133,6 +134,9 @@ namespace NinjaTrader.NinjaScript.Indicators detectedPatterns.RemoveAt(i); } } + + if (MaxPatterns > 0 && detectedPatterns.Count > MaxPatterns) + detectedPatterns.RemoveAt(0); } protected override void OnRender(ChartControl chartControl, ChartScale chartScale) @@ -177,6 +181,10 @@ namespace NinjaTrader.NinjaScript.Indicators [XmlIgnore] [Display(Name = "Bearish Level", Description = "Stroke for bearish level drawn on chart", Order = 3, GroupName = "3CR")] public Stroke BearishLevelStroke { get; set; } + + [Range(0, int.MaxValue)] + [Display(Name = "Max Patterns", Description = "Maximum number of patterns to process", Order = 4, GroupName = "3CR")] + public int MaxPatterns { get; set; } } }