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.636
Tracking Error
0.239
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
from AlgorithmImports import *


class Consolidator(QCAlgorithm):

    def Initialize(self):

        self.SetStartDate(2021, 1, 1)
        self.SetCash(100000)
        self.aapl = self.AddEquity("AAPL", Resolution.Minute).Symbol

        self.weeklyConsolidator = self.Consolidate(self.aapl, Calendar.Weekly, self.WeeklyTradeBarHandler)
        self.rsi = RelativeStrengthIndex(14)
        self.RegisterIndicator(self.aapl, self.rsi, self.weeklyConsolidator)

        self.SetBenchmark(self.aapl)

    def WeeklyTradeBarHandler(self, tradebar):
        pass        
    
    def OnData(self, data):
        if not self.rsi.IsReady:
            return

        # if not self.Portfolio.Invested and self.rsi.Current.Value <= 50.0:
        #     self.SetHoldings(self.aapl, 0.5)
        #     self.Debug("First Buy")

        # elif self.rsi.Current.Value <= 15.0:
        #     self.MarketOrder(self.aapl, 10)

        # elif self.rsi.Current.Value <= 85.0:
        #     self.MarketOrder(self.aapl, -10)

        self.Plot("Indicators", "RSI 1W", self.rsi.Current.Value)