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
Loss Rate
0%
Win Rate
0%
Profit-Loss Ratio
0
Alpha
0
Beta
0
Annual Standard Deviation
0
Annual Variance
0
Information Ratio
0
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
from datetime import timedelta

class RsiAlert(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019,1,10)  #Set Start Date
        self.SetEndDate(2019,2,1)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        self.AddCrypto("BTCUSD", Resolution.Minute, Market.GDAX)
        
        #10-period RSI indicators
        self.rsi5 = RelativeStrengthIndex(10, MovingAverageType.Simple)
        self.rsi15 = RelativeStrengthIndex(10, MovingAverageType.Simple)
        
        #Consolidators
        FiveMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=5))
        FifteenMinuteConsolidator = TradeBarConsolidator(timedelta(minutes=15))
        
        self.SubscriptionManager.AddConsolidator("BTCUSD", FiveMinuteConsolidator)
        self.SubscriptionManager.AddConsolidator("BTCUSD", FifteenMinuteConsolidator)
        
        self.RegisterIndicator("BTCUSD", self.rsi5, FiveMinuteConsolidator)
        self.RegisterIndicator("BTCUSD", self.rsi15, FifteenMinuteConsolidator)
        

    def OnData(self, data):
        if self.rsi5.IsReady:
            rsi5_value = self.rsi5.Current.Value
            if rsi5_value > 70:
                self.Notify.Sms("+1999999999", str(data.Time) + "BTCUSD 5 min RSI high: " + str(rsi5_value))
            if rsi5_value < 30:
                self.Notify.Sms("+1999999999", str(data.Time) + "BTCUSD 5 min RSI low: " + str(rsi5_value))
        if self.rsi15.IsReady:
            rsi15_value = self.rsi15.Current.Value
            if rsi15_value > 70:
                self.Notify.Sms("+1999999999", str(data.Time) + "BTCUSD 15 min RSI high: " + str(rsi15_value))
            if rsi15_value < 30:
                self.Notify.Sms("+1999999999", str(data.Time) + "BTCUSD 15 min RSI low: " + str(rsi15_value))