Loading…

Parameter Neighbourhood Prober

A Strategy Tester optimisation can hand back a parameter pair that looks excellent purely because that exact combination happened to fit the historical noise - the classic overfitting fingerprint is that combinations a step or two away perform very differently, not similarly. Checking that by hand means running several more Tester passes and comparing tables. This EA instead runs the WHOLE neighbourhood live at once: every (fast, slow) EMA-period combination within a configurable number of steps of a centre pair trades independently, tagged with its own magic number, at the same tiny lot size, on the same chart. A running per-combo report (CSV plus an on-chart comment) shows closed net profit per combination side by side, so a genuine edge - one that holds up across the whole neighbourhood - looks visibly different from a lucky spike that only the exact optimised pair reaches. Because this sends real orders, it carries real-money risk if misconfigured, and it is designed around that: it refuses to trade at all unless the account is confirmed demo (InpRequireDemoAccount, on by default, switched off only deliberately), and every lot size is hard-capped by InpSafetyLotCeiling regardless of what InpFixedLots or the broker's own maximum lot allow - a probe like this has no reason to ever carry meaningful size, live or demo. Notes and limitations - Running InpNeighbourhoodSteps = 2 with InpStepSize small enough to keep every combo valid (fast < slow) can open up to 25 concurrent combo slots; each is capped at InpSafetyLotCeiling, but 25 tiny positions is still 25 live positions - size the ceiling accordingly. - This is a live/demo sensitivity check, not a Tester optimisation replacement - it needs real elapsed time (and therefore real bars) to produce a meaningful trade count per combo, unlike a Tester pass which can compress years into minutes. - The demo-account guard checks ACCOUNT_TRADE_MODE at OnInit() only; it does not re-check on every tick, so an account type change mid-session (rare, but possible via terminal login) is not caught until the EA is reattached. - Lot sizing uses broker MODE_LOTSTEP/MODE_MINLOT/MODE_MAXLOT before the safety ceiling is applied - no hardcoded contract size anywhere in the sizing path. - Each combo's closed-trade profit is read from order history filtered by that combo's own magic number; combos never share or interfere with each other's positions.

Expert advisor · MT4 · v1.0 · Free

About Parameter Neighbourhood Prober

Parameter Neighbourhood Prober is an expert advisor (trading robot) for MetaTrader 4 based on Moving Average and ATR. It opens a grid of orders at fixed price steps. It has 14 settings, such as Require demo account, Base fast period and Base slow period. MQL source code included.

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

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Require demo accounttrueRefuse to trade unless this is a demo account - switch off only deliberately
Base fast period10Centre of the fast-EMA neighbourhood
Base slow period30Centre of the slow-EMA neighbourhood
Neighbourhood steps1Combos extend +/- this many steps in each dimension (max 2)
Step size2Period increment per neighbourhood step
Fixed lots0.01Requested lot size per combo - hard-capped, see InpSafetyLotCeiling
Safety lot ceiling0.05Absolute maximum lot size this EA will ever send, no matter what is requested
Atr period14ATR period for each combo's protective stop
Stop atr multiple2.0Stop distance, in ATR multiples
Magic base40400First magic number; each combo gets InpMagicBase + its index
Slippage pips3Slippage tolerance, in pips
Max retries3Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds
Report fileParameterNeighbourhoodProber_Report.csvPer-combo running results, under MQL4\Files\

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 → Experts.
  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 expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Grid · Moving Average · Risk & Lot Size · ATR · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria