Add long-term trend period parameter to Engulfing strategy

This commit is contained in:
moshferatu 2024-12-18 07:47:49 -08:00
parent fea62f40df
commit f29f350d19

View File

@ -1,6 +1,7 @@
#region Using declarations #region Using declarations
using NinjaTrader.Cbi; using NinjaTrader.Cbi;
using NinjaTrader.NinjaScript.Indicators; using NinjaTrader.NinjaScript.Indicators;
using System.ComponentModel.DataAnnotations;
#endregion #endregion
namespace NinjaTrader.NinjaScript.Strategies namespace NinjaTrader.NinjaScript.Strategies
@ -17,10 +18,12 @@ namespace NinjaTrader.NinjaScript.Strategies
Description = @"Simple strategy based on the engulfing candle pattern"; Description = @"Simple strategy based on the engulfing candle pattern";
Calculate = Calculate.OnBarClose; Calculate = Calculate.OnBarClose;
EntriesPerDirection = 1; EntriesPerDirection = 1;
LongTermTrendPeriod = 200;
} }
else if (State == State.DataLoaded) else if (State == State.DataLoaded)
{ {
LongTermTrend = SMA(200); LongTermTrend = SMA(LongTermTrendPeriod);
} }
} }
@ -47,5 +50,10 @@ namespace NinjaTrader.NinjaScript.Strategies
{ {
get { return Name; } get { return Name; }
} }
[NinjaScriptProperty]
[Range(1, int.MaxValue)]
[Display(Name = "Long-Term Trend Period", GroupName = "Engulfing Bot", Order = 1)]
public int LongTermTrendPeriod { get; set; }
} }
} }