I generated this strat with the experimental AI option. I understand approxCompare but need help understanding what the "Values" sections are doing/refering to. I looked at the documentation for "Values", but I'm still not clear. Any help appreciated.
David
namespace NinjaTrader.NinjaScript.Strategies
{
public class AutoStrategy : Strategy
{
protected override void OnStateChange()
{
base.OnStateChange();
if (State == State.SetDefaults)
{
IncludeTradeHistoryInBacktest = false;
IsInstantiatedOnEachOptimizationIteration = true;
MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
Name = "AutoStrategy";
SupportsOptimizationGraph = false;
}
else if (State == State.Configure)
{
}
else if (State == State.DataLoaded)
{
AddChartIndicator(KeltnerChannel(1.40625, 9));
AddChartIndicator(KeltnerChannel(1.125, 9));
AddChartIndicator(KeltnerChannel(0.84375, 10));
AddChartIndicator(KeltnerChannel(1.5, 10));
}
}
protected override void OnBarUpdate()
{
base.OnBarUpdate();
if (CurrentBars[0] < BarsRequiredToTrade)
return;
if (KeltnerChannel(1.40625, 9)[1].ApproxCompare(KeltnerChannel(1.125, 9).Values[2][2]) > 0)
EnterLong();
if (KeltnerChannel(0.84375, 10).Values[1][0].ApproxCompare(KeltnerChannel(1.5, 10)[1]) <= 0)
ExitLong();
}
}
}​

Comment