Remove hard-coded long-term trend period value from ConnorsRSI strategy

This commit is contained in:
moshferatu 2025-01-09 08:02:24 -08:00
parent 9d8e5974b8
commit 1344107973

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;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
#endregion #endregion
@ -39,7 +40,7 @@ namespace NinjaTrader.NinjaScript.Strategies
protected override void OnBarUpdate() protected override void OnBarUpdate()
{ {
if (CurrentBar < 200) if (CurrentBar < Math.Max(LongTermTrendPeriod, PercentRankPeriod))
return; return;
if (Close[0] > longTermTrend[0] && connorsRSI[0] < 15) if (Close[0] > longTermTrend[0] && connorsRSI[0] < 15)