diff --git a/strategies/2-period-rsi/TwoPeriodRSI.cs b/strategies/2-period-rsi/TwoPeriodRSI.cs index f8d9332..ed1a062 100644 --- a/strategies/2-period-rsi/TwoPeriodRSI.cs +++ b/strategies/2-period-rsi/TwoPeriodRSI.cs @@ -43,6 +43,7 @@ namespace NinjaTrader.NinjaScript.Strategies ShortTermTrendPeriod = 5; UseFixedPositionSizing = false; FixedPositionSize = 10000; + LongOnly = false; } else if (State == State.DataLoaded) { @@ -68,7 +69,7 @@ namespace NinjaTrader.NinjaScript.Strategies if (Position.MarketPosition != MarketPosition.Long) EnterLong(quantity); } - else if (Close[0] < longTermTrend[0] && rsi[0] > ShortEntryThreshold) + else if (Close[0] < longTermTrend[0] && rsi[0] > ShortEntryThreshold && !LongOnly) { if (Position.MarketPosition != MarketPosition.Short) EnterShort(quantity); @@ -116,5 +117,9 @@ namespace NinjaTrader.NinjaScript.Strategies [NinjaScriptProperty] [Display(Name = "Fixed Position Size", GroupName = "2 Period RSI", Order = 8)] public int FixedPositionSize { get; set; } + + [NinjaScriptProperty] + [Display(Name = "Long Only", GroupName = "2 Period RSI", Order = 9)] + public bool LongOnly { get; set; } } }