Add property for configuring the maximum number of patterns to process in order to support backtests spanning multiple years / decades
This commit is contained in:
parent
99c71f59f2
commit
69453746a1
@ -45,6 +45,7 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
BarLookback = 5;
|
BarLookback = 5;
|
||||||
BullishLevelStroke = new Stroke(Brushes.LimeGreen, DashStyleHelper.Solid, 2);
|
BullishLevelStroke = new Stroke(Brushes.LimeGreen, DashStyleHelper.Solid, 2);
|
||||||
BearishLevelStroke = new Stroke(Brushes.Red, DashStyleHelper.Solid, 2);
|
BearishLevelStroke = new Stroke(Brushes.Red, DashStyleHelper.Solid, 2);
|
||||||
|
MaxPatterns = 0;
|
||||||
}
|
}
|
||||||
if (State == State.DataLoaded)
|
if (State == State.DataLoaded)
|
||||||
{
|
{
|
||||||
@ -133,6 +134,9 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
detectedPatterns.RemoveAt(i);
|
detectedPatterns.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MaxPatterns > 0 && detectedPatterns.Count > MaxPatterns)
|
||||||
|
detectedPatterns.RemoveAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
|
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
|
||||||
@ -177,6 +181,10 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
[XmlIgnore]
|
[XmlIgnore]
|
||||||
[Display(Name = "Bearish Level", Description = "Stroke for bearish level drawn on chart", Order = 3, GroupName = "3CR")]
|
[Display(Name = "Bearish Level", Description = "Stroke for bearish level drawn on chart", Order = 3, GroupName = "3CR")]
|
||||||
public Stroke BearishLevelStroke { get; set; }
|
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; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user