Broker Capability Probe
Code written and tested against one broker quietly assumes every broker behaves the same way. It does not. Stop level and freeze level alone range from zero on some ECN accounts to forty points or more on some dealing-desk accounts. Quote digits can be 2, 3, 4 or 5, which changes what "one pip" even means for the same nominal distance. Trading can be disabled for one specific symbol while the account overall is fine. A strategy that hardcodes a ten point stop distance works perfectly on the broker it was built against and gets every stop order rejected with error 130 on the next one. This header probes everything MarketInfo and the account functions expose PASSIVELY. It never sends a test order to learn something, because a test order is itself a side effect on a real account and the very kind of surprise this library exists to prevent. Probe() fills a single struct with digits, point, tick size and value, spread, stop level, freeze level, the three lot constraints, symbol- and terminal-level trade permission, connection state, and the account's stopout mode and level. Two small helper checks turn the raw numbers into a decision: IsStopDistanceSafe tells you before sending whether a candidate stop distance clears this broker's stop level, and IsInFreezeZone tells you whether modifying an order that close would be refused. Both take the probed struct rather than re-reading MarketInfo, so a strategy can probe once at OnInit and reuse the result on every tick without repeated broker round trips. Notes and limitations - Everything here is read passively. Nothing that can only be learned by attempting a trade - such as the exact rejection behaviour for an edge-of-limit price, or whether pending order expirations must land on specific time boundaries - is detected, because detecting it would require placing a real, order-book-altering test trade. - On MQL4, MarketInfo returns zero for every field on a symbol the terminal has never synchronised, and Probe() treats digits==0 && point==0.0 together as "unknown symbol". On MQL5, Probe() instead checks whether the SymbolInfoInteger read itself failed - see MQL4 VERSUS MQL5 DIFFERENCES. Either way, add the symbol to Market Watch first if a probe keeps failing. - Freeze level of zero is common on ECN-style accounts and genuinely means no freeze zone exists, not that the probe failed. - Stopout mode and level describe the ACCOUNT, not the symbol - they do not change between symbols probed on the same account in the same run. - This library does not check margin or account balance. A capability check passing does not mean a trade will be accepted for funding reasons. - On MQL5, symbolTradeAllowed is a boolean collapse of a 5-state trade mode - see MQL4 VERSUS MQL5 DIFFERENCES before relying on it for anything more specific than "not fully disabled".
Script · MT4 · v1.0 · Free
About Broker Capability Probe
Broker Capability Probe is a script for MetaTrader 4. It has 2 settings, such as Extra symbol and Candidate stop pts. MQL source code included.
Files in the download: BrokerCapabilityProbe.mqh, BrokerCapabilityProbe.txt, BrokerCapabilityProbeDemo.mq4.
Settings
| Setting | Default | What it does |
|---|---|---|
| Extra symbol | GBPUSD | A second symbol to probe alongside the chart symbol |
| Candidate stop pts | 5 | Stop distance in points to test against this broker's rules |
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: MT4 Script · MQL4 Source Code