Thanks for your help!
I can't seem to attach a new backtest because of the below error. If I remove:
// Add option for every added security
foreach (var security in changes.AddedSecurities) {
if (security is Option) continue;
var option = AddOption(security.Symbol);
option.SetFilter(-2, 2, TimeSpan.Zero, TimeSpan.FromDays(45));
}
from 'OnSecuritiesChanged,' the backtest appears to work and consider multiple securities and also doesn't give the error.
I see the occasional error `Runtime Error: System.InvalidCastException: Specified cast is not valid` in OnSecuritiesChanged, thoughts?
When I switched back to universe selection, the code seems to only be considering SPY, here's some output from the line:
Debug("Securities added: " + string.Join(",", changes.AddedSecurities.Select(x => x.Symbol.Value)));
973 | 20:03:35: Securities added: SPY
974 | 20:03:39: Securities added: SPY 160318C00194500, SPY 160318C00195000, SPY 160318C00195500,SPY 160318C00196000,SPY 160318P00194500, SPY 160318P00195000, SPY 160318P00195500,SPY 160318P00196000,SPY ...
975 | 20:03:39: Securities added: SPY 160318C00194000, SPY 160318P00194000, SPY 160415C00194000,SPY 160415P00194000
976 | 20:03:40: Securities added: SPY 160318C00196500, SPY 160318P00196500
977 | 20:03:40: Securities added: SPY 160318C00197000, SPY 160318P00197000, SPY 160415C00197000, SPY 160415P00197000
978 | 20:03:41: Securities added: SPY 160318C00197500, SPY 160318P00197500
979 | 20:03:42: Securities added: SPY 160318C00198000, SPY 160318P00198000, SPY 160415C00198000, SPY 160415P00198000
980 | 20:03:43: Securities added: SPY 160318C00198500, SPY 160318P00198500