Loading…

Chart Image Sequence Exporter

Reviewing how a chart pattern built up bar by bar usually means manually scrolling and screenshotting one frame at a time, or recording screen video and scrubbing through it later. This script automates the screenshot side: it steps the attached chart's visible window back through history in fixed bar increments and saves a numbered PNG at each step, oldest state first, so the resulting file sequence can be flipped through like a flipbook or assembled into a timelapse with any external tool. ChartScreenShot only queues the capture rather than completing it synchronously - this build's version also takes a leading chart_id argument rather than the shorter signature some documentation examples show. Each step in this script polls for the output file to actually appear on disk (with a bounded timeout) before moving on to the next step, rather than firing every capture back-to-back and risking a missed or half-written frame if the terminal falls behind. Notes and limitations This only moves the chart's SCROLL POSITION (which bars are visible), not the terminal window itself - no MQL4 function can move or resize the actual chart window, and this script does not attempt to. If the requested InpTotalSteps x InpBarsPerStep exceeds the bars actually loaded on the chart, the start point is clamped to the oldest available bar rather than failing, so fewer distinct frames than requested may be produced (the sequence stops early once it reaches the newest bar). The run temporarily disables chart autoscroll to hold the scroll position steady between steps, and restores both the original scroll position and the original autoscroll setting when finished or if a step fails partway through. A screenshot that fails to appear within InpMaxWaitMs is skipped (logged, not retried) rather than blocking the rest of the sequence indefinitely.

Script · MT5 · v1.0 · Free

About Chart Image Sequence Exporter

Chart Image Sequence Exporter is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Total steps, Bars per step and Image width. MQL source code included.

Files in the download: ChartImageSequence.ex5, ChartImageSequence.mq5, ChartImageSequence.txt.

Settings

SettingDefaultWhat it does
Total steps20Number of screenshots to capture
Bars per step50Bars revealed between one screenshot and the next
Image width900Screenshot width, pixels
Image height500Screenshot height, pixels
File prefixChartSequenceFilename prefix, written into MQL5\Files\ as <prefix>_NNN.png
Max wait ms3000Maximum wait per screenshot for the file to appear, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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: Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria