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
-0.779
Tracking Error
0.248
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
# Be sure to import all needed libraries
from QuantConnect.Indicators import *
from QuantConnect.Indicators import Stochastic
from datetime import timedelta
from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *
from QuantConnect.Data.Consolidators import *

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

class projectx(QCAlgorithm):
    
    def Initialize(self):
        self.SetStartDate(2020, 1, 1)
        self.SetEndDate(2021, 4, 30)
        self.SetCash(10000)
        self.stock  = self.AddCrypto(STOCK, Resolution.Daily)
        self.SetWarmUp((RSI_PERIOD + STO_PERIOD * 7), Resolution.Daily)
        
        # Define the consolidator for one week
        consolidator = TradeBarConsolidator(timedelta(days=7))
        
        # Set consolidator to receive updates
        consolidator.DataConsolidated += self.OnDataConsolidated

        # Set subscription (just use ticker here)
        self.SubscriptionManager.AddConsolidator(STOCK, consolidator)

        # Declare indicators with full designation (helper "STO" updates at equity resolution) 
        # since they will update on a consolidated basis
        self.stoch = Stochastic("Stochastic", STO_PERIOD, 3, 3)  # FastStoch, StochK, StochD
        
        # Register the indicator (use ticker here, not Symbol)
        self.RegisterIndicator(STOCK, self.stoch, consolidator)
        
    
    # Add OnDataConsolidated (where consolidated data is piped in)
    def OnDataConsolidated(self, sender, bar):
    
        # Plot indicator to test
        self.Plot("Stochastic 7-day", STOCK, self.stoch.Current.Value)