Hi I am trying to test universe selection via indicators by using tick data, and I am getting this
Runtime Error: Calling History method with Resolution.Tick will return an empty result. Please use the generic version with Tick type parameter or provide a list of Symbols to use the Slice history request API.
The following is the related code -
public override void Initialize()
{
SetStartDate(2020, 7, 3);
SetEndDate(2020, 7, 14);
SetCash(100000);
AddUniverse(CoarseSelectionFilter);
UniverseSettings.Resolution = Resolution.Tick;
}
public IEnumerable<Symbol> CoarseSelectionFilter(IEnumerable<CoarseFundamental> universe)
{
var selected = new List<Symbol>();
universe = universe
.Where(x => x.Price > 10)
.OrderByDescending(x => x.DollarVolume).Take(100);
foreach (var coarse in universe)
{
var symbol = coarse.Symbol;
if (!averages.ContainsKey(symbol))
{
//1. Call history to get an array of 200 tick of history data
var history = History(symbol, 200, Resolution.Tick);
//2. Adjust SelectionData to pass in the history result
averages[symbol] = new SelectionData(history);
}
averages[symbol].Update(Time, coarse.AdjustedPrice);
if (averages[symbol].IsReady() && averages[symbol].Fast > averages[symbol].Slow)
{
selected.Add(coarse.Symbol);
}
}