Overall Statistics
Total Trades
377
Average Win
0.01%
Average Loss
-0.03%
Compounding Annual Return
-0.896%
Drawdown
0.600%
Expectancy
-0.104
Net Profit
-0.524%
Sharpe Ratio
-1.662
Probabilistic Sharpe Ratio
1.218%
Loss Rate
39%
Win Rate
61%
Profit-Loss Ratio
0.46
Alpha
-0.015
Beta
0.03
Annual Standard Deviation
0.005
Annual Variance
0
Information Ratio
-3.235
Tracking Error
0.067
Treynor Ratio
-0.304
Total Fees
$377.00
class BasicTemplateAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
        self.SetStartDate(2017,1, 1)  #Set Start Date
        self.SetEndDate(2017,7,31)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        self.AddEquity("SPY", Resolution.Minute)
        self.rsi = self.RSI("SPY", 14)

        self.SetWarmUp(14)

    def OnData(self, data):
        
        if self.IsWarmingUp:
            return
    
    
        if not self.Portfolio["SPY"].Invested:
            
            if self.rsi.Current.Value < 25:
                self.MarketOrder("SPY", 100)
        
        
        else:
            if self.rsi.Current.Value > 50:
                self.Liquidate()
            
            
    def OnEndOfDay(self):
        self.Plot("Indicators","RSI", self.rsi.Current.Value)