diff --git a/strategies/OpeningRangeBot.cs b/strategies/OpeningRangeBot.cs index c481612..ae30dd0 100644 --- a/strategies/OpeningRangeBot.cs +++ b/strategies/OpeningRangeBot.cs @@ -50,15 +50,18 @@ namespace NinjaTrader.NinjaScript.Strategies protected override void OnBarUpdate() { + if (PrimaryBars != BarsInProgress) + return; + // TODO: Make this timezone-agnostic. if (ToTime(Time[0]) <= 70000) return; - if (PrimaryBars != BarsInProgress) + if (Position.MarketPosition != MarketPosition.Flat) return; if (Open[0] < OR.ORH[0] && Close[0] > OR.ORH[0]) - { + { SetStopLoss(CalculationMode.Price, Low[0]); EnterLong(); }