Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
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

Close All Positions and Orders (Filtered) - script pour MetaTrader 5

Vues:
120
Note:
(1)
Publié:
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

Close All (Filtered) is a script that closes open positions and deletes pending orders in one run. Filters let you close only what you mean to: for example only the losing sells of one EA, or only the profitable trades on the current chart.

Before doing anything, the script counts the positions and orders that match the filters and asks for confirmation. Positions that fail to close (requote, busy server) are retried, and the return code of every failure is printed in the Experts log. At the end a summary shows how many items were closed or deleted out of how many matched.

Confirmation before closing

Confirmation box before closing

Input parameters

  • Current chart symbol only - true: only the chart symbol, false: all symbols.
  • Magic number - -1 = any, 0 = manual trades only, any other value = that EA only.
  • Side - buys and sells, buys only, or sells only.
  • Which positions - all, only in profit, or only in loss (profit plus swap).
  • Close positions - enable or disable closing positions.
  • Delete pending orders - deletes matching pending orders; applied only when "Which positions" = All.
  • Ask for confirmation first - shows a Yes/No box with the number of items.
  • Retries - number of passes for positions that fail to close.
  • Max deviation - allowed slippage in points.

Input parameters

Input parameters

The script uses the standard CTrade class and works on both netting and hedging accounts. Algo Trading must be enabled in the terminal.

Range Compression Zones Breakout Range Compression Zones Breakout

Range Compression Zones Breakout draws range compression zones and marks breakouts that pass a higher-timeframe high/low filter and a volume filter. Inspired by the range compression idea in Domenico D'Errico's Accumulation/Distribution study (TASC, August 2018). Independent implementation, not a literal port of the published study.

Tick-Based Spread Distribution Profiler reads historical Bid/Ask ticks via CopyTicksRange Tick-Based Spread Distribution Profiler reads historical Bid/Ask ticks via CopyTicksRange

Tick-Based Spread Distribution Profiler reads historical Bid/Ask ticks via CopyTicksRange() and plots 24h spread percentiles (P50, P90, P99) in a separate subwindow.

Candle Timer and Spread Candle Timer and Spread

Shows the time left until the current candle closes and the live spread in any chart corner. Keeps counting every second, even when no ticks arrive.

Lot Size Calculator - Risk Percent to Lots Lot Size Calculator - Risk Percent to Lots

Calculates the correct lot size from your risk (% of balance, % of equity or a fixed amount) and stop-loss distance. Shows actual risk and margin. Never places trades.