Loading…

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

SettingDefaultWhat it does
Scan all symbolsfalseScan every known symbol, not only Market Watch
Tolerance percent5.0Allowed disagreement before a symbol is flagged, percent
Export csvfalseWrite the full table to a CSV file

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

MQL4 & MQL5 scripts · PolyMaria