self.add_ohlc

lumibot.strategies.strategy.Strategy.add_ohlc(self, name: str, open: float, high: float, low: float, close: float, color: str = None, detail_text: str = None, dt: datetime | Timestamp = None, plot_name: str = 'default_plot', asset: Asset = None)

Adds an OHLC (candlestick) data point to the indicator chart.

This can be used to plot price bars, Heikin Ashi candles, or any other OHLC series on the indicator chart. OHLC data is exported to indicators.csv with type=”ohlc” and (when supported by the viewer) can be rendered as candlesticks.

Parameters:
  • name (str) – The name of the OHLC series.

  • open (float) – The opening value for the bar.

  • high (float) – The high value for the bar.

  • low (float) – The low value for the bar.

  • close (float) – The closing value for the bar.

  • color (str, optional) – The color for this bar. If omitted, defaults to “green” for bullish (close >= open) and “red” for bearish (close < open).

  • detail_text (str, optional) – Additional hover text.

  • dt (datetime.datetime or pandas.Timestamp, optional) – The datetime for this bar. Defaults to current strategy datetime.

  • plot_name (str, optional) – Subplot name. Default “default_plot”.

  • asset (Asset, optional) – Asset metadata for multi-symbol charting.