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
-3.124
Tracking Error
0.107
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
# RSI Slope

# -----------------------------------------------------------
STOCK = 'QQQ'; BAR = 30; RSI_PERIOD = 14; MA = 14; DELAY = 1;
# -----------------------------------------------------------

class RSI_Slope(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2021,11,1)  
        self.SetEndDate(datetime.now())  
        self.SetCash(25000) 
        self.SetBenchmark(STOCK)
        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage)
        self.stock = self.AddEquity(STOCK, Resolution.Minute).Symbol
        self.SetWarmUp((RSI_PERIOD + DELAY + 1)*BAR, Resolution.Minute) 
        consolidator = TradeBarConsolidator(timedelta(minutes = BAR))
        consolidator.DataConsolidated += self.thirtyMinuteBarHandler
        self.rsi = RelativeStrengthIndex(RSI_PERIOD)
        self.RegisterIndicator(self.stock, self.rsi, consolidator)
        self.sma_rsi = IndicatorExtensions.SMA(self.rsi, MA) 
        self.sma_rsi_past = IndicatorExtensions.Of(Delay(DELAY), self.sma_rsi)
        self.rsi_slope = IndicatorExtensions.Minus(self.sma_rsi, self.sma_rsi_past)
        

    def thirtyMinuteBarHandler(self, sender, consolidated):
        if self.IsWarmingUp or not self.rsi_slope.IsReady: return 

        self.Plot('RSI SLOPE', 'rsi_slope', self.rsi_slope.Current.Value) 
        self.Plot('RSI SLOPE', 'zero', 0)