Remove NinjaScriptProperty attributes in order to clean up indicator constructor

This commit is contained in:
moshferatu 2024-07-14 07:20:45 -07:00
parent e73d3b8205
commit c090342bc7

View File

@ -136,48 +136,40 @@ namespace NinjaTrader.NinjaScript.Indicators
public double RSIModifier public double RSIModifier
{ get; set; } { get; set; }
[NinjaScriptProperty]
[PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")] [PropertyEditor("NinjaTrader.Gui.Tools.StringStandardValuesEditorKey")]
[TypeConverter(typeof(RSIHistogramColorSchemeConverter))] [TypeConverter(typeof(RSIHistogramColorSchemeConverter))]
[Display(Name = "Color Scheme", Description = "RSI histogram coloring scheme", Order = 4, GroupName = "RSI Histogram")] [Display(Name = "Color Scheme", Description = "RSI histogram coloring scheme", Order = 4, GroupName = "RSI Histogram")]
public RSIHistogramColorScheme ColorScheme public RSIHistogramColorScheme ColorScheme
{ get; set; } { get; set; }
[NinjaScriptProperty]
[XmlIgnore] [XmlIgnore]
[Display(Name = "Positive Bar Color", Description = "Color of bars with a positive value", Order = 5, GroupName = "RSI Histogram")] [Display(Name = "Positive Bar Color", Description = "Color of bars with a positive value", Order = 5, GroupName = "RSI Histogram")]
public Brush PositiveBarColor public Brush PositiveBarColor
{ get; set; } { get; set; }
[NinjaScriptProperty]
[XmlIgnore] [XmlIgnore]
[Display(Name = "Negative Bar Color", Description = "Color of bars with a negative value", Order = 6, GroupName = "RSI Histogram")] [Display(Name = "Negative Bar Color", Description = "Color of bars with a negative value", Order = 6, GroupName = "RSI Histogram")]
public Brush NegativeBarColor public Brush NegativeBarColor
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Show Levels", Order = 1, GroupName = "Levels")] [Display(Name = "Show Levels", Order = 1, GroupName = "Levels")]
public bool ShowLevels public bool ShowLevels
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Range(double.MinValue, double.MaxValue)] [Range(double.MinValue, double.MaxValue)]
[Display(Name = "Upper Level", Description = "Upper level in histogram", Order = 2, GroupName = "Levels")] [Display(Name = "Upper Level", Description = "Upper level in histogram", Order = 2, GroupName = "Levels")]
public double UpperLevel public double UpperLevel
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Upper Level Style", Description = "Upper level displayed in histogram", Order = 3, GroupName = "Levels")] [Display(Name = "Upper Level Style", Description = "Upper level displayed in histogram", Order = 3, GroupName = "Levels")]
public Stroke UpperLevelStroke public Stroke UpperLevelStroke
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Range(double.MinValue, double.MaxValue)] [Range(double.MinValue, double.MaxValue)]
[Display(Name = "Lower Level", Description = "Lower level in histogram", Order = 4, GroupName = "Levels")] [Display(Name = "Lower Level", Description = "Lower level in histogram", Order = 4, GroupName = "Levels")]
public double LowerLevel public double LowerLevel
{ get; set; } { get; set; }
[NinjaScriptProperty]
[Display(Name = "Lower Level Style", Description = "Lower level displayed in histogram", Order = 5, GroupName = "Levels")] [Display(Name = "Lower Level Style", Description = "Lower level displayed in histogram", Order = 5, GroupName = "Levels")]
public Stroke LowerLevelStroke public Stroke LowerLevelStroke
{ get; set; } { get; set; }
@ -247,54 +239,6 @@ public class RSIHistogramColorSchemeConverter : TypeConverter
{ return true; } { return true; }
} }
namespace NinjaTrader.NinjaScript.Strategies
{
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{
public Indicators.RSIHistogram RSIHistogram(int rsiPeriod, int rsiSmoothing, double rsiModifier)
{
return indicator.RSIHistogram(
Input,
rsiPeriod,
rsiSmoothing,
rsiModifier,
Indicators.RSIHistogram.DefaultColorScheme,
Indicators.RSIHistogram.DefaultPositiveBarColor,
Indicators.RSIHistogram.DefaultNegativeBarColor,
Indicators.RSIHistogram.DefaultShowLevels,
Indicators.RSIHistogram.DefaultUpperLevel,
Indicators.RSIHistogram.DefaultLevelStroke,
Indicators.RSIHistogram.DefaultLowerLevel,
Indicators.RSIHistogram.DefaultLevelStroke
);
}
}
}
namespace NinjaTrader.NinjaScript.Indicators
{
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{
public RSIHistogram RSIHistogram(int rsiPeriod, int rsiSmoothing, double rsiModifier)
{
return RSIHistogram(
Input,
rsiPeriod,
rsiSmoothing,
rsiModifier,
Indicators.RSIHistogram.DefaultColorScheme,
Indicators.RSIHistogram.DefaultPositiveBarColor,
Indicators.RSIHistogram.DefaultNegativeBarColor,
Indicators.RSIHistogram.DefaultShowLevels,
Indicators.RSIHistogram.DefaultUpperLevel,
Indicators.RSIHistogram.DefaultLevelStroke,
Indicators.RSIHistogram.DefaultLowerLevel,
Indicators.RSIHistogram.DefaultLevelStroke
);
}
}
}
#region NinjaScript generated code. Neither change nor remove. #region NinjaScript generated code. Neither change nor remove.
namespace NinjaTrader.NinjaScript.Indicators namespace NinjaTrader.NinjaScript.Indicators
@ -302,18 +246,18 @@ namespace NinjaTrader.NinjaScript.Indicators
public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase
{ {
private RSIHistogram[] cacheRSIHistogram; private RSIHistogram[] cacheRSIHistogram;
public RSIHistogram RSIHistogram(int rSIPeriod, int rSISmoothing, double rSIModifier, RSIHistogramColorScheme colorScheme, Brush positiveBarColor, Brush negativeBarColor, bool showLevels, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke) public RSIHistogram RSIHistogram(int rSIPeriod, int rSISmoothing, double rSIModifier)
{ {
return RSIHistogram(Input, rSIPeriod, rSISmoothing, rSIModifier, colorScheme, positiveBarColor, negativeBarColor, showLevels, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke); return RSIHistogram(Input, rSIPeriod, rSISmoothing, rSIModifier);
} }
public RSIHistogram RSIHistogram(ISeries<double> input, int rSIPeriod, int rSISmoothing, double rSIModifier, RSIHistogramColorScheme colorScheme, Brush positiveBarColor, Brush negativeBarColor, bool showLevels, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke) public RSIHistogram RSIHistogram(ISeries<double> input, int rSIPeriod, int rSISmoothing, double rSIModifier)
{ {
if (cacheRSIHistogram != null) if (cacheRSIHistogram != null)
for (int idx = 0; idx < cacheRSIHistogram.Length; idx++) for (int idx = 0; idx < cacheRSIHistogram.Length; idx++)
if (cacheRSIHistogram[idx] != null && cacheRSIHistogram[idx].RSIPeriod == rSIPeriod && cacheRSIHistogram[idx].RSISmoothing == rSISmoothing && cacheRSIHistogram[idx].RSIModifier == rSIModifier && cacheRSIHistogram[idx].ColorScheme == colorScheme && cacheRSIHistogram[idx].PositiveBarColor == positiveBarColor && cacheRSIHistogram[idx].NegativeBarColor == negativeBarColor && cacheRSIHistogram[idx].ShowLevels == showLevels && cacheRSIHistogram[idx].UpperLevel == upperLevel && cacheRSIHistogram[idx].UpperLevelStroke == upperLevelStroke && cacheRSIHistogram[idx].LowerLevel == lowerLevel && cacheRSIHistogram[idx].LowerLevelStroke == lowerLevelStroke && cacheRSIHistogram[idx].EqualsInput(input)) if (cacheRSIHistogram[idx] != null && cacheRSIHistogram[idx].RSIPeriod == rSIPeriod && cacheRSIHistogram[idx].RSISmoothing == rSISmoothing && cacheRSIHistogram[idx].RSIModifier == rSIModifier && cacheRSIHistogram[idx].EqualsInput(input))
return cacheRSIHistogram[idx]; return cacheRSIHistogram[idx];
return CacheIndicator<RSIHistogram>(new RSIHistogram(){ RSIPeriod = rSIPeriod, RSISmoothing = rSISmoothing, RSIModifier = rSIModifier, ColorScheme = colorScheme, PositiveBarColor = positiveBarColor, NegativeBarColor = negativeBarColor, ShowLevels = showLevels, UpperLevel = upperLevel, UpperLevelStroke = upperLevelStroke, LowerLevel = lowerLevel, LowerLevelStroke = lowerLevelStroke }, input, ref cacheRSIHistogram); return CacheIndicator<RSIHistogram>(new RSIHistogram(){ RSIPeriod = rSIPeriod, RSISmoothing = rSISmoothing, RSIModifier = rSIModifier }, input, ref cacheRSIHistogram);
} }
} }
} }
@ -322,14 +266,14 @@ namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns
{ {
public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase
{ {
public Indicators.RSIHistogram RSIHistogram(int rSIPeriod, int rSISmoothing, double rSIModifier, RSIHistogramColorScheme colorScheme, Brush positiveBarColor, Brush negativeBarColor, bool showLevels, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke) public Indicators.RSIHistogram RSIHistogram(int rSIPeriod, int rSISmoothing, double rSIModifier)
{ {
return indicator.RSIHistogram(Input, rSIPeriod, rSISmoothing, rSIModifier, colorScheme, positiveBarColor, negativeBarColor, showLevels, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke); return indicator.RSIHistogram(Input, rSIPeriod, rSISmoothing, rSIModifier);
} }
public Indicators.RSIHistogram RSIHistogram(ISeries<double> input , int rSIPeriod, int rSISmoothing, double rSIModifier, RSIHistogramColorScheme colorScheme, Brush positiveBarColor, Brush negativeBarColor, bool showLevels, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke) public Indicators.RSIHistogram RSIHistogram(ISeries<double> input , int rSIPeriod, int rSISmoothing, double rSIModifier)
{ {
return indicator.RSIHistogram(input, rSIPeriod, rSISmoothing, rSIModifier, colorScheme, positiveBarColor, negativeBarColor, showLevels, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke); return indicator.RSIHistogram(input, rSIPeriod, rSISmoothing, rSIModifier);
} }
} }
} }
@ -338,14 +282,14 @@ namespace NinjaTrader.NinjaScript.Strategies
{ {
public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase
{ {
public Indicators.RSIHistogram RSIHistogram(int rSIPeriod, int rSISmoothing, double rSIModifier, RSIHistogramColorScheme colorScheme, Brush positiveBarColor, Brush negativeBarColor, bool showLevels, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke) public Indicators.RSIHistogram RSIHistogram(int rSIPeriod, int rSISmoothing, double rSIModifier)
{ {
return indicator.RSIHistogram(Input, rSIPeriod, rSISmoothing, rSIModifier, colorScheme, positiveBarColor, negativeBarColor, showLevels, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke); return indicator.RSIHistogram(Input, rSIPeriod, rSISmoothing, rSIModifier);
} }
public Indicators.RSIHistogram RSIHistogram(ISeries<double> input , int rSIPeriod, int rSISmoothing, double rSIModifier, RSIHistogramColorScheme colorScheme, Brush positiveBarColor, Brush negativeBarColor, bool showLevels, double upperLevel, Stroke upperLevelStroke, double lowerLevel, Stroke lowerLevelStroke) public Indicators.RSIHistogram RSIHistogram(ISeries<double> input , int rSIPeriod, int rSISmoothing, double rSIModifier)
{ {
return indicator.RSIHistogram(input, rSIPeriod, rSISmoothing, rSIModifier, colorScheme, positiveBarColor, negativeBarColor, showLevels, upperLevel, upperLevelStroke, lowerLevel, lowerLevelStroke); return indicator.RSIHistogram(input, rSIPeriod, rSISmoothing, rSIModifier);
} }
} }
} }