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 · MT4 · v1.0 · Free
About Chart Image Sequence Exporter
Chart Image Sequence Exporter is a script for MetaTrader 4. 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.mq4, ChartImageSequence.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Total steps | 20 | Number of screenshots to capture |
| Bars per step | 50 | Bars revealed between one screenshot and the next |
| Image width | 900 | Screenshot width, pixels |
| Image height | 500 | Screenshot height, pixels |
| File prefix | ChartSequence | Filename prefix, written into MQL4\Files\ as <prefix>_NNN.png |
| Max wait ms | 3000 | Maximum wait per screenshot for the file to appear, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT4 Script · MQL4 Source Code