I want to create a true or false Boolean.
My goal is to create a strategy where first there needs to be a 20 TICK gap from yesterdays close.(this would be the true or false) Then Ninjatrader should look for a stochastic reading greater then or equal 20 ONLY after 11 AM (central time. market for me opens at 8:30 AM) if all of that is true then go long
This is the code I have right now but I have no idea how to make it work, can someone take a look and correct what is wrong with it .
Thank you for you help
#region Inputs
private bool FirstGAP = false;
private int _cntrcts = 1;
private TimeSpan _StartTime = new TimeSpan(8, 31, 0);
private TimeSpan _ExTime = new TimeSpan(15, 14, 0);
private double _StpLs = 200;
private double _PrfTg = 200;
#endregion
protected override void OnBarUpdate()
{
if (Bars.BarsSinceSession >=40)
if (!FirstGAP && Time[0].TimeOfDay == _StartTime && Close[0]>Bars.GetDayBar(1).Close + 20 * TickSize)
{
if (Stochastics(7, 14, 3).D[0] >= 20)
EnterLong(0, 1, "Gap long");
}
SetProfitTarget(50);
}

Comment