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
Sortino 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%
from AlgorithmImports import *

class OHLCDataPrinter(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2024, 1, 1)
        # self.SetEndDate(2022, 8, 20)  # Set an end date for demonstration purposes
        self.SetCash(100000)
        # Add symbol
        symbol = self.AddEquity("AAPL", Resolution.Daily)
        # symbol.SetDataNormalizationMode(DataNormalizationMode.Raw)
        self.symbol = symbol.Symbol  # Store the symbol object

        # Set brokerage Model
        self.SetBrokerageModel(BrokerageName.InteractiveBrokersBrokerage, AccountType.Margin)

        # Set New York timezone
        self.SetTimeZone("America/New_York")

        # Set market open and close times for New York timezone
        # self.SetMarketOpen(time(hour=9, minute=30))
        # self.SetMarketClose(time(hour=16))

    def OnData(self, data):
        if self.symbol in data:  # Access the symbol defined in Initialize
            current_bar = data[self.symbol]
            if current_bar is not None:
                # Print the OHLC data for the current day
                self.Debug(f"Date: {self.Time.date()} | Open: {current_bar.Open} | High: {current_bar.High} | Low: {current_bar.Low} | Close: {current_bar.Close}")