From f29f350d191dab99fffc00ef5d5c8cbb5d4bab99 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Wed, 18 Dec 2024 07:47:49 -0800 Subject: [PATCH] Add long-term trend period parameter to Engulfing strategy --- strategies/engulfing/EngulfingBot.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/strategies/engulfing/EngulfingBot.cs b/strategies/engulfing/EngulfingBot.cs index 763995e..83ea07b 100644 --- a/strategies/engulfing/EngulfingBot.cs +++ b/strategies/engulfing/EngulfingBot.cs @@ -1,6 +1,7 @@ #region Using declarations using NinjaTrader.Cbi; using NinjaTrader.NinjaScript.Indicators; +using System.ComponentModel.DataAnnotations; #endregion namespace NinjaTrader.NinjaScript.Strategies @@ -17,10 +18,12 @@ namespace NinjaTrader.NinjaScript.Strategies Description = @"Simple strategy based on the engulfing candle pattern"; Calculate = Calculate.OnBarClose; EntriesPerDirection = 1; + + LongTermTrendPeriod = 200; } else if (State == State.DataLoaded) { - LongTermTrend = SMA(200); + LongTermTrend = SMA(LongTermTrendPeriod); } } @@ -47,5 +50,10 @@ namespace NinjaTrader.NinjaScript.Strategies { get { return Name; } } + + [NinjaScriptProperty] + [Range(1, int.MaxValue)] + [Display(Name = "Long-Term Trend Period", GroupName = "Engulfing Bot", Order = 1)] + public int LongTermTrendPeriod { get; set; } } }