Symbol Metadata Enricher
Every broker mangles symbol names differently. "EURUSD" on one server is "EURUSD.raw", "EURUSDm" or "EURUSD-ECN" on another, and naive code that assumes a symbol is exactly six characters, or splits it exactly down the middle, breaks the moment a suffix is present. This library classifies and parses by PREFIX search against known currency, metal and crypto code tables instead - it finds the base code at the start of the name, strips it, and looks for a quote code at the start of whatever remains, so trailing suffixes are simply ignored rather than causing a wrong split. Classification checks energy and index keyword lists first (since a symbol like "XTIUSD" would otherwise tempt a metal-vs-currency split on "XT"), then tries crypto, metal and plain forex base tables in that order, and finally falls back to a labelled best-effort "Stock (unconfirmed guess)" class for anything short and alphabetic that matched nothing else - clearly marked as a guess, not a real classification signal, since MQL4 has no dedicated equity-vs-CFD field to check against. The result is a single struct carrying the asset class, whether a base/quote split was actually achieved, the two codes when it was, and a ready-to-display name ("EUR/USD", "Gold vs USD") - built once so every panel, journal line or CSV export in a larger project can reuse the same classification instead of re-deriving it. Notes and limitations - The STOCK class is an unconfirmed best-effort guess (short, all-letter code that matched nothing else) - MQL4 has no field that actually tells you a symbol is an equity CFD, so a short currency- like code that happens to match nothing in the tables (a made-up demo symbol, an unusual broker ticker) will be mislabelled STOCK. - The currency, metal, crypto, energy and index tables are fixed lists compiled into the header. A genuinely new asset (a currency added after this was written, an index the tables don't cover) falls through to UNKNOWN rather than being misclassified - safe, but incomplete for exotic brokers. Extend the tables directly in the header for a specific broker's needs. - Base/quote parsing only ever produces two codes. A symbol whose broker suffix happens to itself look like a currency code immediately after the real quote code (a contrived edge case) is not specifically guarded against beyond taking the first match found. - This header does not query the terminal for anything beyond the symbol name string itself (SymbolMetadataClassify takes a plain string) - it has no opinion on whether the symbol is tradable, visible, or even spelled correctly.
Script · MT4 · v1.0 · Free
About Symbol Metadata Enricher
Symbol Metadata Enricher is a script for MetaTrader 4. It shows several symbols in one panel and is set up for gold (XAUUSD). It has 1 setting, such as Also scan market watch. MQL source code included.
Files in the download: SymbolMetadataEnricher.mqh, SymbolMetadataEnricher.txt, SymbolMetadataEnricherDemo.mq4.
Settings
| Setting | Default | What it does |
|---|---|---|
| Also scan market watch | true | Also classify every symbol currently in Market Watch |
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: Bitcoin & Crypto · EURUSD · Dashboards & Scanners · Gold (XAUUSD) · MT4 Script · MQL4 Source Code