Remove NinjaScriptProperty attributes from plot properties so that strategies based on the %B indicator are not required to pass them into the constructor
This commit is contained in:
parent
42c658d74d
commit
9df47c8ade
@ -76,21 +76,17 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
[Display(Name = "Standard Deviations", GroupName = "%B", Order = 2)]
|
[Display(Name = "Standard Deviations", GroupName = "%B", Order = 2)]
|
||||||
public double StandardDeviations { get; set; }
|
public double StandardDeviations { get; set; }
|
||||||
|
|
||||||
[NinjaScriptProperty]
|
|
||||||
[Range(double.MinValue, double.MaxValue)]
|
[Range(double.MinValue, double.MaxValue)]
|
||||||
[Display(Name = "Upper Level", GroupName = "Plots", Order = 2)]
|
[Display(Name = "Upper Level", GroupName = "Plots", Order = 2)]
|
||||||
public double UpperLevel { get; set; }
|
public double UpperLevel { get; set; }
|
||||||
|
|
||||||
[NinjaScriptProperty]
|
|
||||||
[Display(Name = "Upper Level Stroke", GroupName = "Plots", Order = 3)]
|
[Display(Name = "Upper Level Stroke", GroupName = "Plots", Order = 3)]
|
||||||
public Stroke UpperLevelStroke { get; set; }
|
public Stroke UpperLevelStroke { get; set; }
|
||||||
|
|
||||||
[NinjaScriptProperty]
|
|
||||||
[Range(double.MinValue, double.MaxValue)]
|
[Range(double.MinValue, double.MaxValue)]
|
||||||
[Display(Name = "Lower Level", GroupName = "Plots", Order = 4)]
|
[Display(Name = "Lower Level", GroupName = "Plots", Order = 4)]
|
||||||
public double LowerLevel { get; set; }
|
public double LowerLevel { get; set; }
|
||||||
|
|
||||||
[NinjaScriptProperty]
|
|
||||||
[Display(Name = "Lower Level Stroke", GroupName = "Plots", Order = 5)]
|
[Display(Name = "Lower Level Stroke", GroupName = "Plots", Order = 5)]
|
||||||
public Stroke LowerLevelStroke { get; set; }
|
public Stroke LowerLevelStroke { get; set; }
|
||||||
|
|
||||||
@ -105,18 +101,18 @@ namespace NinjaTrader.NinjaScript.Indicators
|
|||||||
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
|
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
|
||||||
{
|
{
|
||||||
private PercentB[] cachePercentB;
|
private PercentB[] cachePercentB;
|
||||||
public PercentB PercentB(int period, double standardDeviations, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke)
|
public PercentB PercentB(int period, double standardDeviations)
|
||||||
{
|
{
|
||||||
return PercentB(Input, period, standardDeviations, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke);
|
return PercentB(Input, period, standardDeviations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PercentB PercentB(ISeries<double> input, int period, double standardDeviations, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke)
|
public PercentB PercentB(ISeries<double> input, int period, double standardDeviations)
|
||||||
{
|
{
|
||||||
if (cachePercentB != null)
|
if (cachePercentB != null)
|
||||||
for (int idx = 0; idx < cachePercentB.Length; idx++)
|
for (int idx = 0; idx < cachePercentB.Length; idx++)
|
||||||
if (cachePercentB[idx] != null && cachePercentB[idx].Period == period && cachePercentB[idx].StandardDeviations == standardDeviations && cachePercentB[idx].UpperLevel == upperLevel && cachePercentB[idx].UpperLevelStroke == upperLevelStroke && cachePercentB[idx].LowerLevel == lowerLevel && cachePercentB[idx].LowerLevelStroke == lowerLevelStroke && cachePercentB[idx].EqualsInput(input))
|
if (cachePercentB[idx] != null && cachePercentB[idx].Period == period && cachePercentB[idx].StandardDeviations == standardDeviations && cachePercentB[idx].EqualsInput(input))
|
||||||
return cachePercentB[idx];
|
return cachePercentB[idx];
|
||||||
return CacheIndicator<PercentB>(new PercentB(){ Period = period, StandardDeviations = standardDeviations, UpperLevel = upperLevel, UpperLevelStroke = upperLevelStroke, LowerLevel = lowerLevel, LowerLevelStroke = lowerLevelStroke }, input, ref cachePercentB);
|
return CacheIndicator<PercentB>(new PercentB(){ Period = period, StandardDeviations = standardDeviations }, input, ref cachePercentB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,14 +121,14 @@ namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
|
|||||||
{
|
{
|
||||||
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
|
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
|
||||||
{
|
{
|
||||||
public Indicators.PercentB PercentB(int period, double standardDeviations, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke)
|
public Indicators.PercentB PercentB(int period, double standardDeviations)
|
||||||
{
|
{
|
||||||
return indicator.PercentB(Input, period, standardDeviations, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke);
|
return indicator.PercentB(Input, period, standardDeviations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Indicators.PercentB PercentB(ISeries<double> input , int period, double standardDeviations, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke)
|
public Indicators.PercentB PercentB(ISeries<double> input , int period, double standardDeviations)
|
||||||
{
|
{
|
||||||
return indicator.PercentB(input, period, standardDeviations, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke);
|
return indicator.PercentB(input, period, standardDeviations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,14 +137,14 @@ namespace NinjaTrader.NinjaScript.Strategies
|
|||||||
{
|
{
|
||||||
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
|
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
|
||||||
{
|
{
|
||||||
public Indicators.PercentB PercentB(int period, double standardDeviations, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke)
|
public Indicators.PercentB PercentB(int period, double standardDeviations)
|
||||||
{
|
{
|
||||||
return indicator.PercentB(Input, period, standardDeviations, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke);
|
return indicator.PercentB(Input, period, standardDeviations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Indicators.PercentB PercentB(ISeries<double> input , int period, double standardDeviations, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke)
|
public Indicators.PercentB PercentB(ISeries<double> input , int period, double standardDeviations)
|
||||||
{
|
{
|
||||||
return indicator.PercentB(input, period, standardDeviations, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke);
|
return indicator.PercentB(input, period, standardDeviations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user