Prevent trades in the RSI divergence strategy only until there are at least divergence period bars available

This commit is contained in:
moshferatu 2024-08-31 06:25:59 -07:00
parent 5c67629db4
commit 399ba5a35c

View File

@ -46,7 +46,7 @@ namespace NinjaTrader.NinjaScript.Strategies
protected override void OnBarUpdate() protected override void OnBarUpdate()
{ {
if (CurrentBar < BarsRequiredToTrade) if (CurrentBar < DivergencePeriod)
return; return;
if (rsi[0] > rsi[DivergencePeriod] && Close[0] < Close[DivergencePeriod]) if (rsi[0] > rsi[DivergencePeriod] && Close[0] < Close[DivergencePeriod])