Add long and short entry threshold parameters to ConnorsRSI strategy
This commit is contained in:
parent
b5c5029e8f
commit
506a0fe0a5
@ -26,6 +26,8 @@ namespace NinjaTrader.NinjaScript.Strategies
|
|||||||
RSIPeriod = 3;
|
RSIPeriod = 3;
|
||||||
StreakRSIPeriod = 2;
|
StreakRSIPeriod = 2;
|
||||||
PercentRankPeriod = 100;
|
PercentRankPeriod = 100;
|
||||||
|
LongEntryThreshold = 15;
|
||||||
|
ShortEntryThreshold = 85;
|
||||||
LongTermTrendPeriod = 200;
|
LongTermTrendPeriod = 200;
|
||||||
ShortTermTrendPeriod = 5;
|
ShortTermTrendPeriod = 5;
|
||||||
}
|
}
|
||||||
@ -43,9 +45,9 @@ namespace NinjaTrader.NinjaScript.Strategies
|
|||||||
if (CurrentBar < Math.Max(LongTermTrendPeriod, PercentRankPeriod))
|
if (CurrentBar < Math.Max(LongTermTrendPeriod, PercentRankPeriod))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Close[0] > longTermTrend[0] && connorsRSI[0] < 15)
|
if (Close[0] > longTermTrend[0] && connorsRSI[0] < LongEntryThreshold)
|
||||||
EnterLong();
|
EnterLong();
|
||||||
else if (Close[0] < longTermTrend[0] && connorsRSI[0] > 85)
|
else if (Close[0] < longTermTrend[0] && connorsRSI[0] > ShortEntryThreshold)
|
||||||
EnterShort();
|
EnterShort();
|
||||||
|
|
||||||
if (Position.MarketPosition == MarketPosition.Long && Close[0] > shortTermTrend[0])
|
if (Position.MarketPosition == MarketPosition.Long && Close[0] > shortTermTrend[0])
|
||||||
@ -72,11 +74,19 @@ namespace NinjaTrader.NinjaScript.Strategies
|
|||||||
public int PercentRankPeriod { get; set; }
|
public int PercentRankPeriod { get; set; }
|
||||||
|
|
||||||
[NinjaScriptProperty]
|
[NinjaScriptProperty]
|
||||||
[Display(Name = "Long-Term Trend Period", GroupName = "ConnorsRSI Bot", Order = 4)]
|
[Display(Name = "Long Entry Threshold", GroupName = "ConnorsRSI Bot", Order = 4)]
|
||||||
|
public double LongEntryThreshold { get; set; }
|
||||||
|
|
||||||
|
[NinjaScriptProperty]
|
||||||
|
[Display(Name = "Short Entry Threshold", GroupName = "ConnorsRSI Bot", Order = 5)]
|
||||||
|
public double ShortEntryThreshold { get; set; }
|
||||||
|
|
||||||
|
[NinjaScriptProperty]
|
||||||
|
[Display(Name = "Long-Term Trend Period", GroupName = "ConnorsRSI Bot", Order = 6)]
|
||||||
public int LongTermTrendPeriod { get; set; }
|
public int LongTermTrendPeriod { get; set; }
|
||||||
|
|
||||||
[NinjaScriptProperty]
|
[NinjaScriptProperty]
|
||||||
[Display(Name = "Short-Term Trend Period", GroupName = "ConnorsRSI Bot", Order = 5)]
|
[Display(Name = "Short-Term Trend Period", GroupName = "ConnorsRSI Bot", Order = 7)]
|
||||||
public int ShortTermTrendPeriod { get; set; }
|
public int ShortTermTrendPeriod { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user