Loading…

Freeze Level Behaviour Prober

MODE_FREEZELEVEL is supposed to be the distance inside which an order cannot be modified or closed, but not every broker's server enforces exactly what it reports: some report 0 and still reject a too-close modification server-side, others report a non-zero figure that turns out to be advisory rather than enforced. Trusting the reported number blindly can leave an EA's trailing-stop or breakeven logic either too timid (backing off further than necessary) or genuinely broken (retrying a modification that will never be accepted). This script finds out empirically. It opens one minimum-lot test position, then walks a configurable sweep of stop-loss distances centred on the reported freeze level - starting inside the zone (where rejection is expected) and moving outside it (where acceptance is expected) - recording exactly which distances the trade server accepts and rejects. The crossover point in that table is the freeze level as this specific broker actually enforces it, not as it is merely reported. Because this sends and modifies real orders, it carries a hard safety rule: it refuses outright unless the account is a demo account, and it always trades the broker's minimum lot size for the probe. The stop loss is stripped and the test position closed again before the script exits on every exit path, including every early-return error path, so a failed probe never leaves a live position or a resting stop behind. Notes and limitations SAFETY: this script sends and modifies real orders and refuses to run on a live account (checked with IsDemo()). Run it only on demo. It always trades the smallest lot the symbol allows, and guarantees cleanup of the stop loss and the test position on every exit path - but if the terminal itself disconnects mid-probe, the position may still need to be closed manually; the script prints and alerts loudly if a cleanup attempt fails. Results depend on current spread and market conditions at run time and can differ slightly between runs; repeat on a quiet market for the cleanest crossover reading.

Script · MT4 · v1.0 · Free

About Freeze Level Behaviour Prober

Freeze Level Behaviour Prober is an expert advisor (trading robot) for MetaTrader 4. It has 6 settings, such as Symbol, Probe start points and Probe end points. MQL source code included.

Files in the download: FreezeLevelProber.mq4, FreezeLevelProber.txt.

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

Settings

SettingDefaultWhat it does
SymbolSymbol to probe ("" = current chart symbol)
Probe start points-20Distance to start probing from the freeze level, in points (negative = inside)
Probe end points20Distance to end probing, in points (positive = outside)
Probe step points5Step size between probe attempts, in points
Slippage points30Slippage tolerance for the market open/close, in points
Max retries3Retries per probe on a temporary trade-server error

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: Trailing Stop & Break-even · MT4 Script · MQL4 Source Code

MQL4 & MQL5 scripts · PolyMaria