Loading…

Set File Diff Reporter

Two preset files from the same expert are usually identical in nearly every line. A tuning pass, a broker change, or comparing "the version I am running live" against "the version I just optimised" leaves a handful of lines different out of what can be dozens or hundreds. Opening both files in a text editor and reading them side by side to spot the handful that moved does not scale, and it is exactly the kind of task where a changed line sits unnoticed between two identical ones. This script reads both files into a key-to-value table and reports three things: keys whose value changed, keys only present in the first file, and keys only present in the second. Nothing else is printed - a key whose value is identical in both files produces no output at all, which is the entire point of running a diff instead of two file listings. The comparison is line-based on the file's own key text, including the ",F" / ",1" / ",2" / ",3" companion lines the tester writes for an optimisable input's enabled flag, start, step and stop. Two files can therefore report a difference on an input whose current value is identical, because only its optimisation range changed - that is expected, and the key name printed makes clear which part of the input moved. Notes and limitations - Works only on files already inside the terminal's Files sandbox (MQL4\Files or MQL5\Files), not the Presets folder - that restriction is enforced by the terminal itself on both platforms. - Comparison is purely textual. "1" and "1.0" are reported as changed even though the tester would treat them as the same numeric value; this script does not parse or normalise the value column. - A key present with an empty value and a key entirely absent are treated the same way in the summary counts - both show as added or removed. - Line order in the source files does not matter; matching is by key name, not by position. - Very large preset files will run more slowly than a small one, since each key is looked up with a linear scan rather than a hash table - fine for the size of file the tester actually produces.

Script · MT4 · v1.0 · Free

About Set File Diff Reporter

Set File Diff Reporter is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as File a, File b and Write csv. MQL source code included.

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

Settings

SettingDefaultWhat it does
File aFirst .set file, in MQL4\Files
File bSecond .set file, in MQL4\Files
Write csvtrueAlso write the differences to a CSV file
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