Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Telegram !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Scripts

One-Click Close All Positions with Slippage Guard - script pour MetaTrader 5

Gerardo Lopez Martinez
Gerardo Lopez Martinez
  • Algorithmic Trading & Prop Firm Risk Systems à  Institutional MQL5 Developer
  • Mexique
  • 614
Développeur Professionnel MQL5 & C# en Trading Algorithmique | Exécution Institutionnelle & Systèmes de Risque
Vues:
62
Note:
(1)
Publié:
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

One-Click Close All Positions with Slippage Guard is a fast execution utility script for MetaTrader 5 that closes open positions safely while protecting against abnormal spreads and excessive slippage.

How it works:

  • Iterates backwards through open positions and filters by scope, optional Magic Number, and live spread before sending close orders via CTrade .
  • Automatically retries transient broker errors (REQUOTE , PRICE_CHANGED , PRICE_OFF , TIMEOUT , CONNECTION ) and prints a complete execution summary in the Experts log and an Alert popup.

Input Parameters:

  • InpCloseScope (default: CLOSE_ALL_SYMBOLS) — Filter mode: All Symbols, Current Symbol Only, Profitable Positions Only, or Losing Positions Only.
  • InpMagicFilter (default: -1) — Optional Magic Number filter (-1 closes positions from any Magic Number).
  • InpClosePending (default: false) — If true , also deletes matching pending orders.
  • InpMaxSlippagePts (default: 30) — Maximum allowed slippage deviation in points passed to CTrade .
  • InpMaxSpreadPts (default: 0) — Maximum spread in points allowed to close a position (0 disables spread filtering).
  • InpMaxRetries (default: 3) — Maximum retry attempts on transient requotes or price changes.
  • InpRetryDelayMs (default: 100) — Delay in milliseconds between retry attempts.


One-Click Close All Positions with Slippage Guard


Tick Volume Delta Histogram (Buy/Sell Pressure Estimate) Tick Volume Delta Histogram (Buy/Sell Pressure Estimate)

Estimates buy/sell pressure by splitting the tick volume of every bar into a buy part and a sell part. The difference (delta) is shown as a four-color histogram with an optional EMA line.

Session VWAP with Standard Deviation Bands Session VWAP with Standard Deviation Bands

Session-anchored VWAP with volume-weighted standard deviation bands. It restarts at every daily, weekly or monthly session open and shows how far price has stretched from the average price paid during the session.

Spread and Tick Velocity Monitor Spread and Tick Velocity Monitor

Lightweight real-time HUD for MetaTrader 5 that monitors live spread (points and pips), session Min/Avg/Max spread, and tick arrival velocity (ticks/sec and ticks/min) with automatic market regime classification.

MACD Signals MACD Signals

Indicator edition for new platform.