Loading…

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

SettingDefaultWhat it does
Symbol listSemicolon-separated symbols to check (blank = every Market Watch symbol)
Include m1trueInclude M1 in the timeframe set
Include m5trueInclude M5
Include m15trueInclude M15
Include m30falseInclude M30
Include h1trueInclude H1
Include h4trueInclude H4
Include d1trueInclude D1
Include w1falseInclude W1
Include mn1falseInclude MN1

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: Multi-Currency · Alerts · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria