Screenshot Attachment Index
Traders who screenshot every setup end up with a folder of images named whatever the save dialog defaulted to, with no link back to which trade each one belongs to. Matching them by eye during a weekly review means opening image after image and cross-checking timestamps against the history tab by hand. Neither platform can parse a hand-typed filename and know what it means, and there is no ticket-to-file link stored anywhere. What both can read reliably is FILE_MODIFY_DATE on the file itself - the moment the image was actually written to disk - so that is what this script matches against, not the filename. For every image file it finds, the script searches closed trades for the one whose close time sits nearest the file's modify time, within a configurable window. A screenshot taken well outside that window - a chart setup shot with no corresponding trade, or one saved hours after the session ended - is written to the index unmatched rather than pinned to whichever trade happened to be closest regardless of the gap. A false match is worse than an honest blank, because a false match looks like data. Notes and limitations - Matching is by nearest close time within the window, not by content - the script never looks at the image itself. - A file's modify time is when Windows last wrote it, which for most save dialogs is the moment it was created. Copying or editing an image after the fact changes this timestamp and can shift or break a match. - Only market trades are matched against. Pending orders and balance operations never appear as a match. - If two screenshots fall within the window of the same trade, both are matched to it independently - the index does not try to pick one. - Only what MT4's Account History tab has loaded is searched. Choose "All History" first if expected matches are missing.
Script · MT4 · v1.0 · Free
About Screenshot Attachment Index
Screenshot Attachment Index is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Screenshot folder, File mask and Match window minutes. MQL source code included.
Files in the download: ScreenshotAttachmentIndex.ex4, ScreenshotAttachmentIndex.mq4, ScreenshotAttachmentIndex.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Screenshot folder | Screenshots | Subfolder under MQL4\Files holding the images |
| File mask | *.* | File mask, e.g. *.png or *.gif |
| Match window minutes | 30 | Maximum gap to a close time counted as a match |
| Delimiter | DelimiterComma | CSV column separator |
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