For some reason, the strategy does not like this line of code. It won't enable the ATM Strategy. If I comment it out, it enables. What's the problem? Here if the first few lines of code:
protected override void OnBarUpdate()
{
if(CurrentBars[0] < BarsRequiredToTrade || CurrentBars[1] < BarsRequiredToTrade)
return;
Value[0] = SMA(BarsArray[1], 10)[0];
double BarMADiff = Math.Abs(TSI(BarsArray[1],10, 34)[0] - EMA(TSI(BarsArray[1],10, 34), 4)[0]);
// HELP DOCUMENTATION REFERENCE: Please see the Help Guide section "Using ATM Strategies" under NinjaScript--> Educational Resources--> http://ninjatrader.com/support/helpG...strategies.htm
// Make sure this strategy does not execute against historical data
if(State == State.Historical)
return;
if (PositionAccount.MarketPosition == MarketPosition.Long || PositionAccount.MarketPosition == MarketPosition.Short)
{
CloseStrategy(atm_id);
}
Comment