Overall Statistics
Total Trades
900
Average Win
1.45%
Average Loss
-1.18%
Compounding Annual Return
0.983%
Drawdown
44.400%
Expectancy
0.045
Net Profit
13.594%
Sharpe Ratio
0.129
Probabilistic Sharpe Ratio
0.028%
Loss Rate
53%
Win Rate
47%
Profit-Loss Ratio
1.23
Alpha
0.022
Beta
-0.05
Annual Standard Deviation
0.129
Annual Variance
0.017
Information Ratio
-0.384
Tracking Error
0.234
Treynor Ratio
-0.329
Total Fees
$2193.91
class RelativeVigorIndexCrossover(QCAlgorithm):

        def Initialize(self):
            self.SetStartDate(2008, 1, 19)  
            self.SetEndDate(2021, 1, 26)
            self.SetCash(100000)  
            self.AddEquity("SPY", Resolution.Daily).Symbol               
        
            self.rvi = self.RVI("SPY", 14, Resolution.Daily)
            self.AutomaticIndicatorWarmUp = True

            
        def OnData(self, data):
        
            if not self.rvi.IsReady: return   
            
            rvi = self.rvi.Current.Value
            rvi_signal = self.rvi.Signal.Current.Value 
               
            if  rvi > rvi_signal:
                self.SetHoldings("SPY", 1)
            else:
                self.Liquidate("SPY")