diff --git a/strategies/rsi-divergence/RSIDivergenceBot.cs b/strategies/rsi-divergence/RSIDivergenceBot.cs index 00dcb4b..c7f9196 100644 --- a/strategies/rsi-divergence/RSIDivergenceBot.cs +++ b/strategies/rsi-divergence/RSIDivergenceBot.cs @@ -35,6 +35,7 @@ namespace NinjaTrader.NinjaScript.Strategies RSIPeriod = 14; RSISmoothing = 3; + DivergencePeriod = 5; } else if (State == State.DataLoaded) { @@ -47,7 +48,7 @@ namespace NinjaTrader.NinjaScript.Strategies if (CurrentBar < BarsRequiredToTrade) return; - if (rsi[0] > rsi[5] && Close[0] < Close[5]) + if (rsi[0] > rsi[DivergencePeriod] && Close[0] < Close[DivergencePeriod]) EnterLong(); if (Position.MarketPosition == MarketPosition.Long && rsi[0] > 70.0) @@ -68,5 +69,10 @@ namespace NinjaTrader.NinjaScript.Strategies [Range(1, int.MaxValue)] [Display(Name = "RSI Smoothing", GroupName = "RSI Divergence Bot", Order = 2)] public int RSISmoothing { get; set; } + + [NinjaScriptProperty] + [Range(1, int.MaxValue)] + [Display(Name = "Divergence Period", GroupName = "RSI Divergence Bot", Order = 3)] + public int DivergencePeriod { get; set; } } }