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.319
Tracking Error
0.119
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
from QuantConnect.Indicators import *


STOCK = "ETHUSD"; RSI_PERIOD = 14; STO_PERIOD = 14;

class projectx(QCAlgorithm):
    chart = None
    series = None
    
    def Initialize(self):
        self.SetStartDate(2021, 1, 1)  
        self.SetCash(10000)
        self.stock  = self.AddCrypto(STOCK, Resolution.Daily).Symbol 
        self.SetWarmUp((RSI_PERIOD + STO_PERIOD * 7), Resolution.Daily)
        
        
        consolidator = TradeBarConsolidator(Calendar.Weekly)
        self.SubscriptionManager.AddConsolidator(STOCK, consolidator)
        self.rsi = RelativeStrengthIndex(RSI_PERIOD)
        self.RegisterIndicator(STOCK, self.rsi, consolidator)
        
        
        self.stoch = self.STO(self.stock, STO_PERIOD, 3, 3)  # FastStoch, StochK, StochD
        self.rsi.Updated += self.consolidation_handler
        
        self.candles = Series('Daily', SeriesType.Candle)
        self.chart = Chart('Candles')
        self.chart.AddSeries(self.candles)
        self.AddChart(self.chart)
        
    
    def consolidation_handler(self, sender, bar):
        if self.rsi.IsReady:
            rsi = self.rsi.Current.Value
            trade_bar = TradeBar(bar.EndTime, self.stock, rsi, rsi, rsi, rsi, 0)
            self.stoch.Update(trade_bar)
            

    def OnData(self, data):

        if self.IsWarmingUp or not self.stoch: return 

        self.Plot("Indicator", "StochRSI_FastK", self.stoch.FastStoch.Current.Value)
        self.Plot("Indicator", "StochRSI_SlowK", self.stoch.StochK.Current.Value)
        self.Plot('RSI', 'Value', self.rsi.Current.Value)
        
        time = self.UtcTime
        self.candles.AddPoint(time + timedelta(minutes=1), data[STOCK].Open)
        self.candles.AddPoint(time + timedelta(minutes=2), data[STOCK].High)
        self.candles.AddPoint(time + timedelta(minutes=3), data[STOCK].Low)
        self.candles.AddPoint(time + timedelta(minutes=4), data[STOCK].Close)
    

#Project x