Plugins / Smart Execution/Introduction
Introduction
An overview of the Smart Execution plugin and how it manages trade slippage.
What is Smart Execution?
Brokeret Smart Execution is a native C++ MT5 Server Plugin that automatically applies configurable slippage to trades closed within a time threshold. It runs inside the MT5 Trade Server process and monitors deals via the Server API.
Use it to manage execution quality, discourage scalping/latency arbitrage, and protect broker margins on fast-closed trades.
How It Works
- A trader closes a position
- MT5 fires
OnDealPerformwithENTRY_OUT - The plugin calculates the hold duration (close time minus open time)
- If the hold is under threshold (e.g. 120 seconds):
- Finds the matching rule (account rules first, then group rules, highest priority wins)
- Checks filters (profitable only, min profit, min volume, symbol)
- Calculates slippage based on the rule mode
- Adjusts the close price and recalculates profit
- Logs the action
- If the hold is above threshold — the trade passes through untouched
┌─────────────────────────────────────────────────────────┐
│ MT5 Trade Server │
│ │
│ Trader closes BUY EURUSD after 38 seconds │
│ │ │
│ ▼ │
│ OnDealPerform → held < 120s? → Apply 1.5 pips slippage │
│ Close price: 1.08530 → 1.08515 │
│ Profit: $300 → $150 (captured $150) │
└─────────────────────────────────────────────────────────┘
| Position | Close Action | Slippage Direction | Effect |
|---|---|---|---|
| BUY | SELL to close | Lower close price | Less profit / more loss |
| SELL | BUY to close | Raise close price | Less profit / more loss |
Rule System
Rules are evaluated in priority order: Account → Group. The first match wins.
- Account rules — Target specific logins (highest priority, always overrides group rules)
- Group rules — Target MT5 groups with wildcard support (e.g.
real\retail\*) - Within the same scope, higher
prioritynumber wins - Symbol filter is checked during selection — non-matching rules are skipped with fallback to the next rule
Slippage Modes
| Mode | Description |
|---|---|
fixed_pips | Fixed pips or points applied to every fast trade |
percent_profit | Percentage of profit captured (works on all instruments) |
scaled_time | Graduated slippage — faster trades get heavier slippage |
Pips vs Points
- Pips — Automatically adjusted based on symbol digits (1 pip = 10 points for 5/3-digit symbols)
- Points — Raw price points (smallest price increment for the symbol)
Scaled Time Example
| Tier | Duration | Slippage |
|---|---|---|
| 1 | 0–30 seconds | 3.0 pips |
| 2 | 30–60 seconds | 2.0 pips |
| 3 | 60–120 seconds | 1.0 pips |
| 4 | 120+ seconds | 0 (no action) |
Key Features
- Group and Account Targeting — Rule-based targeting with wildcard support and priority fallback
- Three Slippage Modes — Fixed pips/points, percent of profit, or time-scaled
- Symbol-Aware Matching — Rules can target specific symbols with automatic fallback
- Whitelisting — Exempt specific accounts or entire groups from slippage
- PNL Tracking — Optional
DEAL_CHARGEtracking on a dedicated account - 30-Day Statistics — Daily PNL history with live stats
- REST API — Full remote management without MT5 Admin access
- Live Config Reload — Parameter changes in MT5 Admin apply instantly
Monitoring
- Daily Statistics — Total closes, fast closes, slippage applied, profit captured, average slippage
- 30-Day History — Aggregated daily summaries available via the API
- Server Journal — All actions logged with
BrokeretSE:prefix
Next Steps
- Installation — Get the plugin running on your MT5 server
- Parameters — Configure rules and plugin settings
- API Reference — Manage rules, whitelists, and stats via REST