From 399ba5a35cf013d145998824b2450d4bcd3e4fa9 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Sat, 31 Aug 2024 06:25:59 -0700 Subject: [PATCH] Prevent trades in the RSI divergence strategy only until there are at least divergence period bars available --- strategies/rsi-divergence/RSIDivergenceBot.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strategies/rsi-divergence/RSIDivergenceBot.cs b/strategies/rsi-divergence/RSIDivergenceBot.cs index 50041cd..4368de0 100644 --- a/strategies/rsi-divergence/RSIDivergenceBot.cs +++ b/strategies/rsi-divergence/RSIDivergenceBot.cs @@ -46,7 +46,7 @@ namespace NinjaTrader.NinjaScript.Strategies protected override void OnBarUpdate() { - if (CurrentBar < BarsRequiredToTrade) + if (CurrentBar < DivergencePeriod) return; if (rsi[0] > rsi[DivergencePeriod] && Close[0] < Close[DivergencePeriod])