diff --git a/strategies/3-day-high-low/ThreeDayHighLowBot.cs b/strategies/3-day-high-low/ThreeDayHighLowBot.cs index 7e75d70..4f6436c 100644 --- a/strategies/3-day-high-low/ThreeDayHighLowBot.cs +++ b/strategies/3-day-high-low/ThreeDayHighLowBot.cs @@ -43,38 +43,30 @@ namespace NinjaTrader.NinjaScript.Strategies if (EnableLongTrades) { - if (Close[0] > longTermTrend[0] && Close[0] < shortTermTrend[0]) - { - if (IsConsecutiveLowerHighsAndLows(ConsecutiveDays)) - { - if (Position.MarketPosition == MarketPosition.Flat) - EnterLong(); - else if (Position.MarketPosition == MarketPosition.Long && Close[0] < Position.AveragePrice - && EnableAggressiveEntries) - EnterLong(); - } - } - if (Position.MarketPosition == MarketPosition.Long && Close[0] > shortTermTrend[0]) ExitLong(); + else if (Close[0] > longTermTrend[0]) + { + if (IsConsecutiveLowerHighsAndLows(ConsecutiveDays) && Close[0] < shortTermTrend[0] && Position.MarketPosition == MarketPosition.Flat) + EnterLong(); + + if (EnableAggressiveEntries && Position.MarketPosition == MarketPosition.Long && Close[0] < Position.AveragePrice) + EnterLong(); + } } if (EnableShortTrades) { - if (Close[0] < longTermTrend[0] && Close[0] > shortTermTrend[0]) - { - if (IsConsecutiveHigherHighsAndLows(ConsecutiveDays)) - { - if (Position.MarketPosition == MarketPosition.Flat) - EnterShort(); - else if (Position.MarketPosition == MarketPosition.Short && Close[0] > Position.AveragePrice - && EnableAggressiveEntries) - EnterShort(); - } - } - if (Position.MarketPosition == MarketPosition.Short && Close[0] < shortTermTrend[0]) ExitShort(); + else if (Close[0] < longTermTrend[0]) + { + if (IsConsecutiveHigherHighsAndLows(ConsecutiveDays) && Close[0] > shortTermTrend[0] && Position.MarketPosition == MarketPosition.Flat) + EnterShort(); + + if (EnableAggressiveEntries && Position.MarketPosition == MarketPosition.Short && Close[0] > Position.AveragePrice) + EnterShort(); + } } }