Overall Statistics
using System.Drawing; // for Color

namespace QuantConnect 
{ 
    public class ExampleStochasticChartingAlgorithm : QCAlgorithm
    {
        TradeBars prices = new TradeBars();
        
        Stochastic sto;
        
        String _symbol = "BUCY";
        String _plotter = "Stochastic";
        
        int overBought = 20;
        int overSold = 80;
        
        public override void Initialize()
        {
            SetStartDate(2010, 1, 1);
            SetEndDate(2011, 1, 1);
            
            int KPeriod = 14;
            int DPeriod = 3;

            AddSecurity(SecurityType.Equity, _symbol, Resolution.Daily); 
            
            //https://github.com/QuantConnect/Lean/blob/master/Algorithm/QCAlgorithm.Indicators.cs#L530
            sto = STO(_symbol,14,KPeriod,DPeriod);
            
            //Charting in https://github.com/QuantConnect/Lean/blob/master/Common/Charting.cs
            Chart plotter = new Chart(_plotter);
            plotter.AddSeries(new Series("D", SeriesType.Line, " ",Color.Red));
            plotter.AddSeries(new Series("K", SeriesType.Line, " ",Color.Blue));
            plotter.AddSeries(new Series("Over Bought", SeriesType.Line, " ",Color.Black));
            plotter.AddSeries(new Series("Over Sold", SeriesType.Line, " ",Color.Black));
            AddChart(plotter);
            
            Schedule.On(DateRules.EveryDay(), TimeRules.Every(TimeSpan.FromMinutes(10)), () =>
            {
                Log(string.Format("{0} {1}",sto.StochD,sto.StochK));
            }); 
        }
        
        public override void OnEndOfDay() 
        {
        	if (sto.IsReady)
        	{
        		Plot(_plotter,"D", sto.StochD);
        		Plot(_plotter,"K", sto.StochK);
        		Plot(_plotter,"Over Bought", overBought);
        		Plot(_plotter,"Over Sold", overSold);
        	}
        }
    }
    
}