i am already registering the symbo

namespace QuantConnect.Algorithm.CSharp { /// <summary> /// Basic template algorithm simply initializes the date range and cash. This is a skeleton /// framework you can use for designing an algorithm. /// </summary> public class BasicTemplateAlgorithm : QCAlgorithm { private string _spy_s="SPY"; private TradeBar _workingDailyBar,_workingWeeklyBar; private bool dailydataJustConsolidated = false,weeklydataJustConsolidated = false; private Symbol _spy = QuantConnect.Symbol.Create("SPY", SecurityType.Equity, Market.USA); private int totalticks,totaldays; private RollingWindow<TradeBar> _dailywindow, _weeklywindow; private RollingWindow<IndicatorDataPoint> _slowwindow,_fastwindow; private bool movedlong=false; private SimpleMovingAverage slow,fast; /// <summary> /// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized. /// need to consolidate weekly bars. /// </summary> public override void Initialize() { totalticks=0; totaldays=0; SetStartDate(2011, 10, 03); //Set Start Date SetEndDate(2013, 11, 25); //Set End Date SetCash(100000); //Set Strategy Cash // Creates a Rolling Window indicator to keep the 25 TradeBar _dailywindow = new RollingWindow<TradeBar>(25); // For other security types, use QuoteBar _weeklywindow = new RollingWindow<TradeBar>(25); // For other security types, use QuoteBar _slowwindow = new RollingWindow<IndicatorDataPoint>(25); _fastwindow = new RollingWindow<IndicatorDataPoint>(25); slow= SMA(_spy_s,200,Resolution.Daily); slow.Updated+=(sender,updated)=>_slowwindow.Add(updated); fast= SMA(_spy_s,50,Resolution.Daily); fast.Updated+=(sender,updated)=>_fastwindow.Add(updated); // Find more symbols here: http://quantconnect.com/data // Forex, CFD, Equities Resolutions: Tick, Second, Minute, Hour, Daily. // Futures Resolution: Tick, Second, Minute // Options Resolution: Minute Only. AddEquity(_spy_s, Resolution.Second ); TradeBarConsolidator dailyconsolidator = new TradeBarConsolidator(TimeSpan.FromDays(1) ); dailyconsolidator.DataConsolidated += DailyHandler; SubscriptionManager.AddConsolidator(_spy_s, dailyconsolidator); TradeBarConsolidator weeklyconsolidator = new TradeBarConsolidator(TimeSpan.FromDays(7) ); weeklyconsolidator.DataConsolidated += WeeklyHandler; SubscriptionManager.AddConsolidator(_spy_s, weeklyconsolidator); SetWarmUp(TimeSpan.FromDays(500) ); // The time rule here tells it to fire 10 minutes before SPY's market close Schedule.On(DateRules.EveryDay(_spy_s), TimeRules.BeforeMarketClose(_spy_s, 10), () => { Log("EveryDay.SPY 10 min before close: Fired at: " + Time); }); // There are other assets with similar methods. See "Selecting Options" etc for more details. // AddFuture, AddForex, AddCfd, AddOption } /// <summary> /// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here. /// </summary> /// <param name="data">Slice object keyed by symbol containing the stock data</param> public override void OnData(Slice data) { if (IsWarmingUp) return; if (fast.IsReady && slow.IsReady) { Debug("Indicators are ready!"); } ConsolidateDailyWeeklyBars( data); totalticks++; if (!Portfolio.Invested) { SetHoldings(_spy, 1); Debug("Purchased Stock"); } // Log("OnData" + data.Time); } public void OnData(TradeBars data) { // TradeBars objects are piped into this method. //Log( "????open" + data["SPY"].Open); } private void ConsolidateDailyWeeklyBars(Slice data) { //https://groups.google.com/forum/#!topic/lean-engine/JRKIP-QDwNs if(_workingWeeklyBar == null || weeklydataJustConsolidated) { } } protected DateTime GetRoundedBarTime(DateTime time) { // return last EOD time return time.RoundDown(TimeSpan.FromDays(1)); } public override void OnEndOfDay(string symbol) { // close up shop each day and reset our 'last' value so we start tomorrow fresh Log("eod data" + symbol + "total ticks" + totalticks); } public override void OnEndOfDay() { // close up shop each day and reset our 'last' value so we start tomorrow fresh // Log("eod data" ); } public void WeeklyHandler(object sender, TradeBar data) { Log(" *****WeeklyHandler" + data.EndTime + "total days " + totaldays); totaldays=0; _weeklywindow.Add(data); // handle the data each daily here } public void DailyHandler(object sender, TradeBar data) { // Log("Daily Handler" + data.EndTime + "total ticks" + totalticks); totalticks=0; totaldays++; _dailywindow.Add(data); // handle the data each daily here } } }

l at line 47 in the initialize. why do i get this excecption suddenly?

Author