Overall Statistics
import numpy as np

### <summary>
### Basic template algorithm simply initializes the date range and cash. This is a skeleton
### framework you can use for designing an algorithm.
### </summary>
class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2018,8, 1)  #Set Start Date
        self.SetEndDate(2018,8,30)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        # Find more symbols here: http://quantconnect.com/data
        self.AddEquity("IBM", Resolution.Daily)
        self.RSI("IBM", 14, resolution=Resolution.Daily).Updated += self.RsiUpdated
        self.rsiWin = RollingWindow[RelativeStrengthIndex](3)
        self.SetWarmUp(14)
    
    def RsiUpdated(self, sender, updated):
        '''Adds updated values to rolling window'''
        self.rsiWin.Add(updated)
    
    def OnData(self, data):
        self.Debug(self.rsiWin[0].AverageLoss)