Brokeret LogoDocs
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

  1. A trader closes a position
  2. MT5 fires OnDealPerform with ENTRY_OUT
  3. The plugin calculates the hold duration (close time minus open time)
  4. 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
  5. 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)                    │
└─────────────────────────────────────────────────────────┘
PositionClose ActionSlippage DirectionEffect
BUYSELL to closeLower close priceLess profit / more loss
SELLBUY to closeRaise close priceLess 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 priority number wins
  • Symbol filter is checked during selection — non-matching rules are skipped with fallback to the next rule

Slippage Modes

ModeDescription
fixed_pipsFixed pips or points applied to every fast trade
percent_profitPercentage of profit captured (works on all instruments)
scaled_timeGraduated 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

TierDurationSlippage
10–30 seconds3.0 pips
230–60 seconds2.0 pips
360–120 seconds1.0 pips
4120+ seconds0 (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_CHARGE tracking 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