Contract Spec Sanity Suite
Every position-sizing formula ultimately trusts three numbers: contract size, tick size and tick value. They are not independent - for a plain linear instrument, tick value should equal contract size multiplied by tick size. When a broker updates a symbol's specification (a digits change, a contract size adjustment, a new instrument added in a hurry) one of the three fields can be left stale or simply wrong, and nothing in the platform stops a sizing script from reading the bad field and quietly computing the wrong lot size for every trade that follows. This script reads MODE_LOTSIZE, MODE_TICKSIZE and MODE_TICKVALUE for every symbol - always live from MarketInfo, never a hardcoded assumption like 100,000 units per lot - and reports three classes of problem: any of the three fields reading zero or negative (a formula dividing by this would misbehave), a tick size that is not a sane multiple of the symbol's point value, and a tick value that disagrees with contract size times tick size by more than a configurable tolerance. The tolerance exists because metals, indices and futures-style CFDs are legitimately priced through a different formula server-side and can show a real, harmless gap - the report names the gap as a percentage so a genuine specification bug (usually a large, obviously wrong gap) is easy to tell apart from normal cross-instrument variation. Notes and limitations - A flagged tick-value gap is a prompt to check the specification by hand, not automatic proof of a broker error - some instrument classes are correctly priced through a formula this check cannot fully model. - Symbols whose specification is not loaded at all (MODE_POINT reads zero) are skipped and counted separately, never silently treated as passing. - This checks the specification only. It does not simulate an actual trade or verify margin behaviour - see LeverageTierTableBuilder for that. - Re-run after any broker announcement of a specification change, and periodically regardless - specs can change without an announcement.
Script · MT4 · v1.0 · Free
About Contract Spec Sanity Suite
Contract Spec Sanity Suite is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Scan all symbols, Tolerance percent and Export csv. MQL source code included.
Files in the download: ContractSpecSanitySuite.mq4, ContractSpecSanitySuite.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Scan all symbols | false | Scan every known symbol, not only Market Watch |
| Tolerance percent | 5.0 | Allowed disagreement before a symbol is flagged, percent |
| Export csv | false | Write the full table to a CSV file |
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