Render candlestick chart
render_candlestick_chartTurn OHLCV data into candlestick, Heikin-Ashi, or OHLC-bar charts. Returns PNG images with optional volume, overlays, and buy/sell markers.
Instructions
Draw a candlestick (or Heikin-Ashi / OHLC-bar) chart from OHLCV data and return it as a PNG image. Supports a volume panel, moving-average and Bollinger overlays, VWAP, log price scale, horizontal reference lines, buy/sell markers, and light/dark themes. Colours default to a colourblind-safe blue-up / red-down pair; pass colorScheme:"classic" for traditional green/red. No network calls are made.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ema | No | Exponential moving average periods. | |
| sma | No | Simple moving average periods. | |
| vwap | No | Session-anchored VWAP (needs volume on every bar). | |
| scale | No | Device-pixel ratio. Raise for print; 1 keeps the returned image small. | |
| theme | No | dark | |
| title | No | Headline, e.g. "BTCUSD · 1h". Omit for a bare plot. | |
| width | No | Logical width in px. | |
| height | No | Logical height in px. | |
| yScale | No | Use log for multi-year or high-growth ranges. | linear |
| candles | Yes | OHLCV bars, oldest first (any order is accepted and sorted). Two accepted forms per bar: {"time":…,"open":…,"high":…,"low":…,"close":…,"volume":…} or the compact tuple [time, open, high, low, close, volume?]. Prefer the tuple form for long series — it costs far fewer tokens. | |
| markers | No | Triangular annotations: buy below the bar, sell above it. | |
| showGrid | No | ||
| subtitle | No | Second header line. Defaults to the date range, bar count and last close. | |
| timeZone | No | IANA time zone used for every axis and header label. | UTC |
| bodyStyle | No | Override body fill. Defaults to filled for diverging, hollow-up for classic and mono. | |
| bollinger | No | Bollinger band overlay. | |
| chartType | No | candlestick = classic bodies; heikin-ashi = smoothed bodies; ohlc-bars = Western bar chart. | candlestick |
| priceLines | No | Horizontal reference lines — support, resistance, entry, stop. | |
| showLegend | No | ||
| showVolume | No | Volume panel below the price panel (needs a volume column). | |
| colorScheme | No | diverging = blue up / red down (validated colourblind-safe, the default). classic = green up / red down (traditional but not CVD-safe, so up bodies are drawn hollow). mono = ink only, direction by hollow vs filled. | diverging |
| showLastPrice | No | Dashed line plus axis chip at the final close. |