diff --git a/strategies/daily-reversal/DailyReversalBot.cs b/strategies/daily-reversal/DailyReversalBot.cs index 29b09b7..b1aca71 100644 --- a/strategies/daily-reversal/DailyReversalBot.cs +++ b/strategies/daily-reversal/DailyReversalBot.cs @@ -2,6 +2,7 @@ using NinjaTrader.Cbi; using NinjaTrader.Data; using System; +using System.ComponentModel.DataAnnotations; #endregion namespace NinjaTrader.NinjaScript.Strategies @@ -35,6 +36,8 @@ namespace NinjaTrader.NinjaScript.Strategies StopTargetHandling = StopTargetHandling.PerEntryExecution; BarsRequiredToTrade = 2; IsInstantiatedOnEachOptimizationIteration = true; + + PositionSize = 10000; } else if (State == State.Configure) { @@ -53,7 +56,7 @@ namespace NinjaTrader.NinjaScript.Strategies return; // Using fixed position sizing to account for lower index values in the past. - int quantity = (int)Math.Floor(10000 / Close[0]); + int quantity = (int)Math.Floor(PositionSize / Close[0]); if (Lows[PrimaryBars][0] < Lows[PrimaryBars][1] && Highs[PrimaryBars][0] < Highs[PrimaryBars][1]) { @@ -66,5 +69,11 @@ namespace NinjaTrader.NinjaScript.Strategies if (ToTime(Time[0]) == ToTime(sessionClose.AddMinutes(-1))) ExitLong(); } + + [NinjaScriptProperty] + [Range(1, int.MaxValue)] + [Display(Name = "Position Size", GroupName = "Daily Reversal Bot", Order = 1)] + public int PositionSize + { get; set; } } }