From 9e0590bad77b0409e4825ae5ff25ae8090333722 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Sat, 31 Aug 2024 06:15:18 -0700 Subject: [PATCH] Add RSI period and smoothing properties to RSI divergence strategy --- strategies/rsi-divergence/RSIDivergenceBot.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/strategies/rsi-divergence/RSIDivergenceBot.cs b/strategies/rsi-divergence/RSIDivergenceBot.cs index a9c8ac7..00dcb4b 100644 --- a/strategies/rsi-divergence/RSIDivergenceBot.cs +++ b/strategies/rsi-divergence/RSIDivergenceBot.cs @@ -1,6 +1,7 @@ #region Using declarations using NinjaTrader.Cbi; using NinjaTrader.NinjaScript.Indicators; +using System.ComponentModel.DataAnnotations; #endregion namespace NinjaTrader.NinjaScript.Strategies @@ -31,10 +32,13 @@ namespace NinjaTrader.NinjaScript.Strategies StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 20; IsInstantiatedOnEachOptimizationIteration = true; + + RSIPeriod = 14; + RSISmoothing = 3; } else if (State == State.DataLoaded) { - rsi = RSI(14, 3); + rsi = RSI(RSIPeriod, RSISmoothing); } } @@ -54,5 +58,15 @@ namespace NinjaTrader.NinjaScript.Strategies { get { return Name; } } + + [NinjaScriptProperty] + [Range(1, int.MaxValue)] + [Display(Name = "RSI Period", GroupName = "RSI Divergence Bot", Order = 1)] + public int RSIPeriod { get; set; } + + [NinjaScriptProperty] + [Range(1, int.MaxValue)] + [Display(Name = "RSI Smoothing", GroupName = "RSI Divergence Bot", Order = 2)] + public int RSISmoothing { get; set; } } }