Add entry and exit threshold parameters to internal bar strength strategy
This commit is contained in:
parent
c58b5e826c
commit
1ef352b424
@ -1,6 +1,7 @@
|
||||
#region Using declarations
|
||||
using NinjaTrader.Cbi;
|
||||
using NinjaTrader.NinjaScript.Indicators;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
#endregion
|
||||
|
||||
namespace NinjaTrader.NinjaScript.Strategies
|
||||
@ -17,6 +18,9 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
Description = @"Long only bot which bases trades on internal bar strength";
|
||||
Calculate = Calculate.OnBarClose;
|
||||
EntriesPerDirection = 1;
|
||||
|
||||
EntryThreshold = 0.2;
|
||||
ExitThreshold = 0.8;
|
||||
}
|
||||
else if (State == State.DataLoaded)
|
||||
{
|
||||
@ -29,9 +33,9 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
if (CurrentBar < BarsRequiredToTrade)
|
||||
return;
|
||||
|
||||
if (ibs[0] < 0.2)
|
||||
if (ibs[0] < EntryThreshold)
|
||||
EnterLong();
|
||||
else if (ibs[0] > 0.8 && Position.MarketPosition == MarketPosition.Long)
|
||||
else if (ibs[0] > ExitThreshold && Position.MarketPosition == MarketPosition.Long)
|
||||
ExitLong();
|
||||
}
|
||||
|
||||
@ -39,5 +43,13 @@ namespace NinjaTrader.NinjaScript.Strategies
|
||||
{
|
||||
get { return Name; }
|
||||
}
|
||||
|
||||
[NinjaScriptProperty]
|
||||
[Display(Name = "Entry Threshold", GroupName = "Internal Bar Strength Bot", Order = 1)]
|
||||
public double EntryThreshold { get; set; }
|
||||
|
||||
[NinjaScriptProperty]
|
||||
[Display(Name = "Exit Threshold", GroupName = "Internal Bar Strength Bot", Order = 2)]
|
||||
public double ExitThreshold { get; set; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user