Loading…

Demo Versus Live Symbol Diff

A strategy tested for weeks on a demo account can behave differently the day it goes live, and not because the logic changed - because the demo and live symbol specifications were never actually the same. Stop level, minimum lot, tick value and margin requirement are all set per account type by some brokers, quietly, with nothing on either platform telling you they diverged. One terminal cannot read another terminal's live settings directly - they are two separate processes, often on two separate machines. This script works around that the only honest way: run it in Export mode on one terminal to write every symbol's specification to a CSV, copy that file to the other terminal's Files folder, then run it in Compare mode there. The compare step reads the file and checks every field against what this terminal reports live for the same symbol right now, printing only the fields that actually differ rather than dumping the full specification for every symbol whether it matches or not. Eleven fields are compared: digits, point, minimum lot, maximum lot, lot step, tick size, tick value, stop level, freeze level, contract size and margin required. A symbol present in the file but not available on the comparing terminal is reported separately, since that is a different problem - a missing instrument, not a mismatched specification. Notes and limitations - This never reads another terminal's settings directly. The file is the only channel between the two runs, so the comparison is only as current as the moment the export was taken - if the broker changes a live setting afterwards, re-export before comparing again. - A symbol present in the file but unavailable on the comparing terminal is reported as missing, not silently skipped or treated as identical. - Floating-point fields (other than margin_required) are compared with a small absolute tolerance to avoid reporting a difference caused by rounding rather than an actual specification mismatch. - On the MQL5 version specifically, a margin_required difference alone, with nothing else differing for that symbol, is expected across separate export and compare runs even on an identical account configuration, because the figure is now computed against live price rather than read as a static broker constant. Treat a margin_required-only difference as informational, not evidence of a real specification mismatch. - The eleven fields compared are the ones common to every symbol on both platforms. Session times and swap figures are not included; run SymbolSpecDump from this catalogue on each terminal separately if those matter too.

Script · MT4 · v1.0 · Free

About Demo Versus Live Symbol Diff

Demo Versus Live Symbol Diff is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Mode, Symbol list and Export file name. MQL source code included.

Files in the download: DemoVersusLiveSymbolDiff.ex4, DemoVersusLiveSymbolDiff.mq4, DemoVersusLiveSymbolDiff.txt.

Settings

SettingDefaultWhat it does
ModeModeExportExport or Compare
Symbol listComma-separated symbols ("" = Market Watch)
Export file namesymbol_specs.csvExport mode: file to write, into MQL4\Files
Compare file namesymbol_specs.csvCompare mode: file to read, from MQL4\Files
DelimiterDelimiterCommaCSV column separator

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