Parameter Plateau Finder
An optimisation report tells you which single value of a parameter scored best. It does not tell you whether that value was surrounded by other values that also did well, or whether it was an island - one lucky setting flanked on both sides by results that fall off a cliff. The second case is the textbook shape of a curve-fit parameter: it worked on this sample because it happened to line up with this sample, and a live account rarely lands on exactly the same number twice. This script reads a CSV already exported from the Optimization Results tab, picks one column as the swept parameter and another as the metric to judge it by (Profit Factor by default), and averages the metric across every pass that shares each parameter value - because a real sweep normally has other parameters varying too, so several rows usually share the same value of the one you are studying. It then sorts those averaged values along the parameter axis and finds the widest contiguous run that stays within a tolerance of the peak. That run is the plateau. Any single qualifying value sitting outside it, with weaker values on both sides, is flagged as an isolated spike. The one number worth reading first in the output is whether the single best value falls inside the plateau or outside it. Inside means the setting has company - nearby values behave similarly, which is what a real edge usually looks like. Outside means the top of the optimisation report is very possibly the exact kind of one-off spike this script exists to catch. Notes and limitations - This measures stability along one parameter at a time. A setting that looks stable when every other parameter is averaged over can still be fragile once the others are fixed - re-run with the rest of the sweep narrowed if that distinction matters to you. - Grouping by parameter value compares the exported text, not the parsed number, so two rows that both read "1.20000" are always grouped together even with floating point noise. A value exported in two different text forms (such as "1.2" and "1.20") would be treated as two separate points. - Column splitting is a plain delimiter split, not a quote-aware CSV parser, matching what a tester export actually produces. - A parameter swept over only two or three values does not give the plateau concept much room to show anything meaningful - it works best on a sweep with a reasonable number of steps. - The tolerance band is a judgement call, not a statistical test. Tighten or loosen InpPlateauTolerancePercent to match how forgiving you want the plateau definition to be.
Script · MT4 · v1.0 · Free
About Parameter Plateau Finder
Parameter Plateau Finder is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 6 settings, such as Input filename, Parameter column name and Metric column name. MQL source code included.
Files in the download: ParameterPlateauFinder.ex4, ParameterPlateauFinder.mq4, ParameterPlateauFinder.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Input filename | Optimisation results CSV, in MQL4\Files | |
| Parameter column name | Header text (substring) of the swept parameter to scan | |
| Metric column name | Profit Factor | Header text (substring) of the metric to average |
| Plateau tolerance percent | 10.0 | Tolerance below peak, percent (used when peak > 0) |
| Plateau tolerance absolute | 0.1 | Tolerance below peak, absolute (used when peak <= 0) |
| Output delimiter | DelimiterComma | Delimiter for the output report |
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