Overall Statistics
namespace QuantConnect 
{   
    /*
    *   Basic Template Algorithm
    *
    *   The underlying QCAlgorithm class has many methods which enable you to use QuantConnect.
    *   We have explained some of these here, but the full base class can be found at:
    *   https://github.com/QuantConnect/Lean/tree/master/Algorithm
    */
    public class RsiUpdateExample : QCAlgorithm
    {
    	Symbol aapl;
    	RelativeStrengthIndex _rsi;
    	Random _rng;
    	
        public override void Initialize() 
        {
        	// backtest parameters
            SetStartDate(2017, 1, 2);         
            SetEndDate(2017, 1, 6);
            
            // cash allocation
            SetCash(25000);
            aapl = AddEquity("AAPL", Resolution.Minute).Symbol;
            
            _rsi = new RelativeStrengthIndex(14, MovingAverageType.Simple);
            _rng = new Random();
            
            Schedule.On(DateRules.EveryDay(), TimeRules.At(16, 00), () =>
            {
                _rsi.Update(new IndicatorDataPoint
        		{
        			Time = Time,
        			Value = Securities[aapl].Price
        		});
        		Log(Time + " RSI updated at Market Close!");
            	
            });
            
        }

        /* 
        *	New data arrives here.
        *	The "Slice" data represents a slice of time, it has all the data you need for a moment.	
        */ 
        public override void OnData(Slice data) 
        {
        	if (_rng.NextDouble() > 0.5)
        	{
        		_rsi.Update(new IndicatorDataPoint
        		{
        			Time = Time,
        			Value = data[aapl].Price
        		});
        		Log(Time + " RSI updated");
        	}
        	
        	if (!_rsi.IsReady) return;
        	//Log("RSI value:" + _rsi.Current.Value);
        	
        
        }
    }
}