Overall Statistics
Total Trades
0
Average Win
0%
Average Loss
0%
Compounding Annual Return
0%
Drawdown
0%
Expectancy
0
Net Profit
0%
Sharpe Ratio
0
Probabilistic Sharpe Ratio
0%
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
2.738
Tracking Error
0.238
Treynor Ratio
0
Total Fees
$0.00
class SPYMeanReversionAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2020,9, 1)  #Set Start Date
        
        self.SetCash(100000)           #Set Strategy Cash
        self.spy = self.AddEquity("SPY", Resolution.Daily)
        self.rsi_wilders = RelativeStrengthIndex(2, MovingAverageType.Wilders)
        self.rsi_exp = RelativeStrengthIndex(2, MovingAverageType.DoubleExponential)

            
    def OnData(self, data):
        self.rsi_wilders.Update(data.Time, data['SPY'].Close)
        self.rsi_exp.Update(data.Time, data['SPY'].Close)
        
        if not self.rsi_wilders.IsReady:
            return
        
        self.Plot("Price", "SPY", data['SPY'].Close)
        self.Plot("RSI", "Wilders", self.rsi_wilders.Current.Value)
        self.Plot("RSI", "Double Exponential", self.rsi_exp.Current.Value)