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.
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-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
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
Indicator edition for new platform.