Loading…

Mini Candle Chart Renderer

A correlated pair, a higher timeframe, or a basket index is often worth keeping half an eye on without opening a second chart window. This library draws a compact candle chart of any symbol/timeframe combination inside a fixed pixel box on the current chart's main window, refreshed on demand. MQL4 has no subwindow of its own to give a Library, and it has no native arc or picture-in-picture object either. The candles are drawn with the same OBJ_TREND wick plus OBJ_RECTANGLE body technique already used elsewhere in this catalogue for synthetic-cross candles, but that technique originally anchored objects inside an indicator's own price- scaled subwindow. Here there is no subwindow: the box is a fixed pixel rectangle on the main chart, so every Render() call first converts the box's screen corners to time/price with ChartXYToTimePrice(), then maps the target symbol's OHLC range linearly into that same time/price rectangle before drawing. Because the mapping is re-derived from pixel coordinates on every call, the inset stays visually pinned to its pixel box even while the host chart is scrolled or zoomed - as long as Render() is called often enough (every tick, or from a short timer) to keep re-deriving that mapping. It does not track chart changes on its own. Notes and limitations - Render() must be called repeatedly (every tick or on a short timer) to stay pinned to its pixel box; a single call draws one frame and then drifts if the chart is scrolled or zoomed afterward. - High/Low mapping uses the simple min/max over the shown bars, not a dynamically rescaling axis with labelled gridlines - it is a compact glance-chart, not a full secondary chart window. - Only the most recent barsToShow bars are drawn each call; older objects beyond that count are pruned automatically. - No money is at risk in the demo. It only reads price history and never sends an order.

Script · MT4 · v1.0 · Free

About Mini Candle Chart Renderer

Mini Candle Chart Renderer is a script for MetaTrader 4. MQL source code included.

Files in the download: MiniCandleChartRenderer.mqh, MiniCandleChartRenderer.txt, MiniCandleChartRendererDemo.mq4.

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria