I would just like to clarify some coding concerns.
I have a strategy running on 1min data (primary series) which relies on Daily data for info such as previous Close and daily ATR.
While running on intraday basis I want to know the previous days close
double lastDailyClose = Closes[1][0];
I also want to know the previous 50 days ATR
double DailyATR = ATR(BarsArray[1],atrLookback)[1];
It would be intuitive that the ATR is given using the same zero [0] index as per the Close but this gives me a zero value.
I just want to verify that this is the correct way of getting the ATR.
Thanks
protected override void Initialize()
{
Add(PeriodType.Day, 1);
CalculateOnBarClose = true;
}
protected override void OnBarUpdate()
{
// 50 Days lookback
if (CurrentBar < 72000) //700
return;
if (BarsInProgress != 0)
return;
double DailyATR = ATR(BarsArray[1],atrLookback)[1];
double lastDailyClose = Closes[1][0];
}
Comment