diff --git a/indicators/connors-rsi/ConnorsRSI.cs b/indicators/connors-rsi/ConnorsRSI.cs index 62e4091..251fee6 100644 --- a/indicators/connors-rsi/ConnorsRSI.cs +++ b/indicators/connors-rsi/ConnorsRSI.cs @@ -13,6 +13,8 @@ namespace NinjaTrader.NinjaScript.Indicators [CategoryOrder("Lines", 3)] public class ConnorsRSI : Indicator { + private const int RSISmoothing = 1; + private RSI rsi; private RSI streakRsi; private ROC roc; @@ -37,9 +39,7 @@ namespace NinjaTrader.NinjaScript.Indicators IsSuspendedWhileInactive = true; RSIPeriod = 3; - RSISmoothing = 1; StreakRSIPeriod = 2; - StreakRSISmoothing = 1; PercentRankPeriod = 100; AddPlot(new Stroke(Brushes.Yellow, 3), PlotStyle.Line, "ConnorsRSI"); @@ -52,7 +52,7 @@ namespace NinjaTrader.NinjaScript.Indicators rsi = RSI(RSIPeriod, RSISmoothing); streak = new Series(this, MaximumBarsLookBack.Infinite); - streakRsi = RSI(streak, StreakRSIPeriod, StreakRSISmoothing); + streakRsi = RSI(streak, StreakRSIPeriod, RSISmoothing); roc = ROC(1); percentRankReturns = PercentRank(roc, PercentRankPeriod); @@ -97,19 +97,11 @@ namespace NinjaTrader.NinjaScript.Indicators public int RSIPeriod { get; set; } [NinjaScriptProperty] - [Display(Name = "RSI Smoothing", GroupName = "ConnorsRSI", Order = 2)] - public int RSISmoothing { get; set; } - - [NinjaScriptProperty] - [Display(Name = "Streak RSI Period", GroupName = "ConnorsRSI", Order = 3)] + [Display(Name = "Streak RSI Period", GroupName = "ConnorsRSI", Order = 2)] public int StreakRSIPeriod { get; set; } [NinjaScriptProperty] - [Display(Name = "Streak RSI Smoothing", GroupName = "ConnorsRSI", Order = 4)] - public int StreakRSISmoothing { get; set; } - - [NinjaScriptProperty] - [Display(Name = "Percent Rank Period", GroupName = "ConnorsRSI", Order = 5)] + [Display(Name = "Percent Rank Period", GroupName = "ConnorsRSI", Order = 3)] public int PercentRankPeriod { get; set; } } } @@ -121,18 +113,18 @@ namespace NinjaTrader.NinjaScript.Indicators public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private ConnorsRSI[] cacheConnorsRSI; - public ConnorsRSI ConnorsRSI(int rSIPeriod, int rSISmoothing, int streakRSIPeriod, int streakRSISmoothing, int percentRankPeriod) + public ConnorsRSI ConnorsRSI(int rSIPeriod, int streakRSIPeriod, int percentRankPeriod) { - return ConnorsRSI(Input, rSIPeriod, rSISmoothing, streakRSIPeriod, streakRSISmoothing, percentRankPeriod); + return ConnorsRSI(Input, rSIPeriod, streakRSIPeriod, percentRankPeriod); } - public ConnorsRSI ConnorsRSI(ISeries input, int rSIPeriod, int rSISmoothing, int streakRSIPeriod, int streakRSISmoothing, int percentRankPeriod) + public ConnorsRSI ConnorsRSI(ISeries input, int rSIPeriod, int streakRSIPeriod, int percentRankPeriod) { if (cacheConnorsRSI != null) for (int idx = 0; idx < cacheConnorsRSI.Length; idx++) - if (cacheConnorsRSI[idx] != null && cacheConnorsRSI[idx].RSIPeriod == rSIPeriod && cacheConnorsRSI[idx].RSISmoothing == rSISmoothing && cacheConnorsRSI[idx].StreakRSIPeriod == streakRSIPeriod && cacheConnorsRSI[idx].StreakRSISmoothing == streakRSISmoothing && cacheConnorsRSI[idx].PercentRankPeriod == percentRankPeriod && cacheConnorsRSI[idx].EqualsInput(input)) + if (cacheConnorsRSI[idx] != null && cacheConnorsRSI[idx].RSIPeriod == rSIPeriod && cacheConnorsRSI[idx].StreakRSIPeriod == streakRSIPeriod && cacheConnorsRSI[idx].PercentRankPeriod == percentRankPeriod && cacheConnorsRSI[idx].EqualsInput(input)) return cacheConnorsRSI[idx]; - return CacheIndicator(new ConnorsRSI(){ RSIPeriod = rSIPeriod, RSISmoothing = rSISmoothing, StreakRSIPeriod = streakRSIPeriod, StreakRSISmoothing = streakRSISmoothing, PercentRankPeriod = percentRankPeriod }, input, ref cacheConnorsRSI); + return CacheIndicator(new ConnorsRSI(){ RSIPeriod = rSIPeriod, StreakRSIPeriod = streakRSIPeriod, PercentRankPeriod = percentRankPeriod }, input, ref cacheConnorsRSI); } } } @@ -141,14 +133,14 @@ namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { - public Indicators.ConnorsRSI ConnorsRSI(int rSIPeriod, int rSISmoothing, int streakRSIPeriod, int streakRSISmoothing, int percentRankPeriod) + public Indicators.ConnorsRSI ConnorsRSI(int rSIPeriod, int streakRSIPeriod, int percentRankPeriod) { - return indicator.ConnorsRSI(Input, rSIPeriod, rSISmoothing, streakRSIPeriod, streakRSISmoothing, percentRankPeriod); + return indicator.ConnorsRSI(Input, rSIPeriod, streakRSIPeriod, percentRankPeriod); } - public Indicators.ConnorsRSI ConnorsRSI(ISeries input , int rSIPeriod, int rSISmoothing, int streakRSIPeriod, int streakRSISmoothing, int percentRankPeriod) + public Indicators.ConnorsRSI ConnorsRSI(ISeries input , int rSIPeriod, int streakRSIPeriod, int percentRankPeriod) { - return indicator.ConnorsRSI(input, rSIPeriod, rSISmoothing, streakRSIPeriod, streakRSISmoothing, percentRankPeriod); + return indicator.ConnorsRSI(input, rSIPeriod, streakRSIPeriod, percentRankPeriod); } } } @@ -157,14 +149,14 @@ namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { - public Indicators.ConnorsRSI ConnorsRSI(int rSIPeriod, int rSISmoothing, int streakRSIPeriod, int streakRSISmoothing, int percentRankPeriod) + public Indicators.ConnorsRSI ConnorsRSI(int rSIPeriod, int streakRSIPeriod, int percentRankPeriod) { - return indicator.ConnorsRSI(Input, rSIPeriod, rSISmoothing, streakRSIPeriod, streakRSISmoothing, percentRankPeriod); + return indicator.ConnorsRSI(Input, rSIPeriod, streakRSIPeriod, percentRankPeriod); } - public Indicators.ConnorsRSI ConnorsRSI(ISeries input , int rSIPeriod, int rSISmoothing, int streakRSIPeriod, int streakRSISmoothing, int percentRankPeriod) + public Indicators.ConnorsRSI ConnorsRSI(ISeries input , int rSIPeriod, int streakRSIPeriod, int percentRankPeriod) { - return indicator.ConnorsRSI(input, rSIPeriod, rSISmoothing, streakRSIPeriod, streakRSISmoothing, percentRankPeriod); + return indicator.ConnorsRSI(input, rSIPeriod, streakRSIPeriod, percentRankPeriod); } } }