To whom this may concern.

I'm having trouble with my algorithm.

On every market open, I want to add all the closeprices of the last 30 days. Which i do like so:

// Calling history data
var todayCloseHistory = History("SPY", todayDate, endDate);
// Adding data to lists
				foreach (TradeBar bars in todayCloseHistory){
				todayVolList.Add(bars.Close);
				}

Later, I then want to create a variable that should be the mean value of the closeprices within the list which i do like so:

decimal mean = todayVolList.Average();

And here the backtest says that line of code contains ‘no elements’.

I have next to no experience coding, so forgive me if my method is all outta whack. But I would really appreciate some help with my issue.

Thanks in advance

:))