Loading…

Broker Throttle Detector

A broker under load, or one that has started rate-limiting a specific account, does not usually announce it - orders simply start taking longer, or start coming back with busy/timeout errors more often. By the time a trading EA notices through its own failed orders, it may already have missed fills or been rejected on trades that mattered. This program treats a resting pending order as a deliberate, harmless latency probe. It places a stop order far enough from the current price that it has no realistic fill risk, at the broker's own minimum lot size, times how long the placement and the immediate cancellation each take, and deletes it again within the same cycle - the position never has meaningful market exposure at any point. Round-trip times are kept in a rolling baseline. A round trip that runs well past its own recent baseline, or a burst of TRADE_CONTEXT_BUSY / timeout / too-frequent-requests errors, is treated as the signature of throttling. When that happens the ping interval itself backs off exponentially (so the detector is not adding to whatever load may be causing the slowdown) and a shared GlobalVariable flag is published so cooperating EAs on the same terminal can slow their own pacing down too - advisory coordination, the same honest limitation as any GlobalVariable-based signal in MQL4. Notes and limitations - This EA sends and cancels real pending orders as its probe mechanism. They are placed far out of the money and cancelled within the same cycle, but they are genuine orders reaching the broker, not a simulation. - The published GlobalVariable flag is advisory only - it cannot force any other EA to slow down, only make the information available to ones written to check it. - A probe cycle that fails outright (order rejected, delete rejected) is itself evidence considered toward the throttle signature, separately from the round-trip timing comparison. - The backed-off interval resets to the configured normal interval the next time a probe cycle completes with a normal round trip - it does not stay backed off forever once conditions recover. - Distance and lot size are deliberately conservative defaults; do not shrink InpPingDistancePips so far that the probe order could realistically be triggered by normal price movement.

Expert advisor · MT4 · v1.0 · Free

About Broker Throttle Detector

Broker Throttle Detector is an expert advisor (trading robot) for MetaTrader 4. It increases the lot size after a losing trade (martingale) and places pending buy/sell stop or limit orders. It has 9 settings, such as Magic, Ping interval seconds and Max ping interval seconds. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Magic25600Magic number for probe orders
Ping interval seconds300Normal spacing between probes, seconds
Max ping interval seconds3600Ceiling for the backed-off interval
Ping distance pips500.0Distance from current price for the probe order, pips
Baseline samples10Rolling window used to compute the round-trip baseline
Throttle multiplier3.0A round trip this many times the baseline counts as throttled
Consecutive fail limit3Consecutive probe failures before pinging pauses for one backoff cycle
Global flag nameBTD_ThrottleSuspectedShared GlobalVariable other EAs may read
Max retries2Attempts per probe leg (send or delete) before giving up that leg

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: Pending Orders · Martingale · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria