OHLC Plot
OHLC (Open-High-Low-Close) plots are a common data visualization tool used in finance to represent the price data of a financial instrument over a specific time frame. Similar to Candlesticks, they display four key prices: the opening price (open), the highest price (high), the lowest price (low), and the closing price (close), typically as vertical bars on a chart, providing insights into price movements and trends.
In OHLC plots, each bar consists of a vertical line with small horizontal lines on both ends. The top of the vertical line represents the high price, the bottom represents the low price, the horizontal line on the left indicates the opening price, and the horizontal line on the right signifies the closing price. Additionally, the color of the bar is often used to indicate whether the closing price was higher (bullish, often green) or lower (bearish, often red) than the opening price, aiding in the quick assessment of price trends and market sentiment. Analyzing the shape, color, and position of these bars helps traders and analysts assess the price movement, trends, and market sentiment within a given time frame.
What are OHLC plots useful for?
- Price trend analysis: OHLC charts provide a clear visual representation of price trends and movements over specific time periods, helping traders and analysts assess market direction.
- Identifying support and resistance: They aid in identifying support and resistance levels, key price points that can inform trading decisions and risk management.
- Quantitative analysis: OHLC data can be leveraged for quantitative analysis, statistical modeling, and the development of trading strategies, making them valuable in algorithmic and systematic trading.
Examples
A basic OHLC plot
Visualize the key summary statistics of a stock price as it evolves. Pass the column name of the instrument to x, and pass the open, high, low, and close arguments the appropriate column names.
Calendar
OHLC plots take a calendar argument. Dates and times are excluded from axes so that they conform to the calendar.
API Reference
Returns an ohlc chart
Returns: DeephavenFigure A DeephavenFigure that contains the ohlc chart
| Parameters | Type | Default | Description |
|---|---|---|---|
| table | Table | DataFrame | A table to pull data from. | |
| x | str | None | None | The column containing x-axis data |
| open | str | list[str] | None | None | The column containing the open data |
| high | str | list[str] | None | None | The column containing the high data |
| low | str | list[str] | None | None | The column containing the low data |
| close | str | list[str] | None | None | The column containing the close data |
| increasing_color_sequence | list[str] | None | None | A list of colors to sequentially apply to the series on increasing bars. The colors loop, so if there are more series than colors, colors will be reused. |
| decreasing_color_sequence | list[str] | None | None | A list of colors to sequentially apply to the series on decreasing bars. The colors loop, so if there are more series than colors, colors will be reused. |
| xaxis_sequence | list[int] | None | None | A list of x axes to assign series to. Odd numbers starting with 1 are created on the bottom x axis and even numbers starting with 2 are created on the top x axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. |
| yaxis_sequence | list[int] | None | None | A list of y axes to assign series to. Odd numbers starting with 1 are created on the left y axis and even numbers starting with 2 are created on the top y axis. Axes are created up to the maximum number specified. The axes loop, so if there are more series than axes, axes will be reused. |
| yaxis_titles | list[str] | None | None | A list of titles to sequentially apply to the y axes. The titles do not loop. |
| xaxis_titles | list[str] | None | None | A list of titles to sequentially apply to the x axes. The titles do not loop. |
| calendar | bool | str | Any | False | A boolean, BusinessCalendar or string that specifies a calendar to use for the chart. By default, False and no calendar is used. If True, the default calendar is used. If a string, the calendar with that name is used. If a BusinessCalendar is passed, that calendar is used. |
| unsafe_update_figure | Callable | <function default_callback> | An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. Note that the existing data traces should not be removed. This may lead to unexpected behavior if traces are modified in a way that break data mappings. |
| on_click | Callable[..., bool | None] | None | None | A callback function that is called when a point is clicked. The function receives a dict with 'points' (list of clicked point data) and 'modifiers' (keyboard state). On hierarchical charts (sunburst, treemap, icicle), return False to prevent drill-down. The return value is ignored on other chart types. |
| on_press | Callable[..., bool | None] | None | None | Alias for on_click. |
| on_double_click | Callable[..., None] | None | None | A callback function that is called on double-click. The function receives a dict with 'modifiers' (keyboard state). Fires in zoom/pan mode only; in select mode, on_deselect fires instead. |
| on_double_press | Callable[..., None] | None | None | Alias for on_double_click. |
| on_selected | Callable[..., None] | None | None | A callback function that is called when a box or lasso selection completes. The function receives a dict with 'points' (list of selected point data), 'range' (for box select), and 'modifiers'. |
| on_deselect | Callable[..., None] | None | None | A callback function that is called when the selection is cleared (e.g., by double-clicking on an empty area). |
| on_relayout | Callable[..., None] | None | None | A callback function that is called when the chart layout changes due to user interaction (pan, zoom, axis reset, etc.). The function receives a dict of the layout keys that changed. |
| on_legend_click | Callable[..., bool | None] | None | None | A callback function that is called when a legend item is clicked. Return False to prevent the default trace visibility toggle. Return True or None to allow it. |
| on_legend_double_click | Callable[..., bool | None] | None | None | A callback function that is called when a legend item is double-clicked. Return False to prevent the default isolate/show-all toggle. Return True or None to allow it. |
| on_click_annotation | Callable[..., None] | None | None | A callback function that is called when an annotation is clicked. The function receives a dict with 'index', 'annotation', and 'modifiers'. |
| on_web_gl_context_lost | Callable[..., None] | None | None | A callback function that is called when the WebGL rendering context is lost (e.g., GPU reclaims resources). |