Overall Statistics
namespace QuantConnect 
    *   QuantConnect University: Full Basic Template:
    *   The underlying QCAlgorithm class is full of helper methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full algorithm can be found at:
    *   https://github.com/QuantConnect/QCAlgorithm/blob/master/QuantConnect.Algorithm/QCAlgorithm.cs
    public class BasicTemplateAlgorithm : QCAlgorithm
        public Stochastic stochastic;
        //Initialize the data and resolution you require for your strategy:
        public override void Initialize()
            //Start and End Date range for the backtest:
            SetStartDate(2014, 6, 1);         
            SetEndDate(2015, 1, 1); 
            //Cash allocation
            //Add as many securities as you like. All the data will be passed into the event handler:
            AddSecurity(SecurityType.Equity, "SPY", Resolution.Minute);
            // create and register 15 minute stochastic indicator
            stochastic = new Stochastic("sto", 14, 3, 3);
            RegisterIndicator("SPY", stochastic, ResolveConsolidator("SPY", TimeSpan.FromMinutes(15)));

        DateTime lastPlot;
        //Data Event Handler: New data arrives here. "TradeBars" type is a dictionary of strings so you can access it by symbol.
        public void OnData(TradeBars data) 
            if (!Portfolio.HoldStock) 
                SetHoldings("SPY", 0.5m);
            if (Time - lastPlot >= TimeSpan.FromMinutes(15))
                Plot("SPY", "stochd", stochastic.StochD.Current.Value);
                Plot("SPY", "stochk", stochastic.StochK.Current.Value);
                lastPlot = Time;