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
Tracking Error
0
Treynor Ratio
0
Total Fees
$0.00
Estimated Strategy Capacity
$0
Lowest Capacity Asset
Portfolio Turnover
0%
# region imports
from AlgorithmImports import *
# endregion

class IntradayVwapAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2023, 10, 6)
        self.SetEndDate(2023, 10, 6)
        self.symbol = self.AddEquity("PRZO", Resolution.Minute, fillForward=False, extendedMarketHours=True).Symbol
        self.atr = AverageTrueRange(15, MovingAverageType.Wilders)
        self.warmed_up = False
        self.bar_count = 0

        history = self.History[TradeBar]([self.symbol], 15, Resolution.Minute)

        for trade_bars in history:
            for symbol, bar in trade_bars.items():
                self.atr.Update(bar)
                self.bar_count += 1

        self.Debug(f'Number of bars received from history: {self.bar_count}')

        if self.atr.IsReady and self.warmed_up == False:
            self.Debug(f'Warmed up in initialize')
            self.warmed_up = True


    def OnData(self, slice: Slice) -> None:
        if self.symbol in slice.Bars:
            bar = slice.Bars[self.symbol]
            self.atr.Update(bar)

            if self.atr.IsReady and self.warmed_up == False:
                self.Debug(f'Warmed up in OnData')
                self.warmed_up = True