History Depth Inventory
Before running a multi-symbol backtest, scan, or export, it helps to know what history the terminal actually has loaded right now - and that answer is scattered one chart at a time unless something reads it all at once. iBars() only reflects history the terminal has already synced for a given symbol/timeframe pair. A symbol that has never been opened on a chart reports zero bars here even though the broker has plenty available, simply because nothing has asked for it yet. That gap is the point of this report: it tells you exactly which symbol/timeframe pairs need a chart opened (or a history download tool run) before whatever you are about to do with them will see real data, rather than finding out mid-backtest that half the symbols were silently empty. The script checks every symbol in Market Watch by default, or a specific list you type in, against a configurable set of standard timeframes, and prints bar count, earliest bar date, latest bar date and the span in days for each pair in one table. Notes and limitations - This is a read-only inventory. It does not download, request or force the terminal to load anything - see DownloadAllHistory elsewhere in this catalogue if what you actually need is more bars. - A zero-bar row usually means the symbol has never been charted on this timeframe in this terminal, not that the broker has no history for it. - Market Watch, when InpSymbolList is left blank, only lists symbols currently selected/visible - a symbol hidden from Market Watch is skipped even if it is tradeable. - Bar counts reflect this terminal's own local cache. Running the same scan on a second terminal for the same account can report different depth if one terminal has simply had its charts open longer.
Script · MT4 · v1.0 · Free
About History Depth Inventory
History Depth Inventory is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 10 settings, such as Symbol list, Include m1 and Include m5. MQL source code included.
Files in the download: HistoryDepthInventory.mq4, HistoryDepthInventory.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Symbol list | Semicolon-separated symbols to check (blank = every Market Watch symbol) | |
| Include m1 | true | Include M1 in the timeframe set |
| Include m5 | true | Include M5 |
| Include m15 | true | Include M15 |
| Include m30 | false | Include M30 |
| Include h1 | true | Include H1 |
| Include h4 | true | Include H4 |
| Include d1 | true | Include D1 |
| Include w1 | false | Include W1 |
| Include mn1 | false | Include MN1 |
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: Multi-Currency · Alerts · MT4 Script · MQL4 Source Code