Overall Statistics
Total Trades
72
Average Win
0.44%
Average Loss
-0.22%
Compounding Annual Return
-5.630%
Drawdown
6.500%
Expectancy
-0.834
Net Profit
-6.495%
Sharpe Ratio
-2.562
Probabilistic Sharpe Ratio
0.000%
Loss Rate
94%
Win Rate
6%
Profit-Loss Ratio
1.98
Alpha
-0.048
Beta
0.008
Annual Standard Deviation
0.018
Annual Variance
0
Information Ratio
-0.829
Tracking Error
0.285
Treynor Ratio
-6.06
Total Fees
$72.00
class LogicalLightBrownGoshawk(QCAlgorithm):

    def Initialize(self):
        
        self.SetStartDate(2020, 1, 1)  # Set Start Date
        self.SetCash(100000)  # Set Strategy Cash
        self.symbol = self.AddEquity("SPY", Resolution.Daily).Symbol
        self.rsi = self.RSI(self.symbol, 14)
        self.SetWarmUp(14)


    def OnData(self, data):
        
        if self.IsWarmingUp:
            
            return
        

        if not self.Portfolio.Invested:
        
            if self.rsi.Current.Value > 70:
                
                self.MarketOrder(self.symbol, -100)
                self.LimitOrder(self.symbol, +100, self.Securities[self.symbol].Close / 0.99)
                
                
            elif self.rsi.Current.Value < 30:
                
                self.MarketOrder(self.symbol, +100)
                self.LimitOrder(self.symbol, -100, self.Securities[self.symbol].Close * 0.99)