거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Telegram에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
스크립트

Close All Positions with Symbol, Magic, Direction and Profit Filters - MetaTrader 5용 스크립트

Wycliffe Wanjala Wanyonyi
Wycliffe Wanjala Wanyonyi
  • Data and Machine Learning Analyst 에  Rudder Data Analytics
  • 케냐
  • 1783
Lead Researcher at Rudder Data Analytics www.rudderdatanalytics.co.ke
조회수:
101
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

closeall


Description


This script closes open positions in one run. Instead of closing everything blindly, you choose exactly which positions to close using four filters: symbol, magic number, direction and profit/loss state.

It is useful when you need to exit quickly, for example before news, at the end of a session, or when you want to close only the losing trades of a grid or only the trades opened by one Expert Advisor.

Input parameters

Close only the chart symbol (true/false): if true, only positions on the symbol of the chart the script is dropped on are closed. Set to false to process all symbols.
Magic number: closes only positions with this magic number. Use -1 for any magic number, or 0 for manually opened trades.
Direction filter: Buy and Sell, Buy only, or Sell only.
Profit/loss filter: All positions, only positions in profit, or only positions in loss. Floating profit includes swap.
Max slippage in points: maximum allowed price deviation when closing.

How to use

1. Copy the file to the MQL5\Scripts folder and compile it in MetaEditor.
2. Turn on the Algo Trading button in the terminal.
3. Drag the script onto a chart. On the Common tab, tick "Allow Algo Trading".
4. Set the filters on the Inputs tab and click OK.

When it finishes, a pop-up shows how many positions were closed or failed. Each closed or failed ticket is printed in the Experts tab with the server return code.

Notes

The script uses the filling mode allowed by the broker for each symbol, so it works with different brokers and execution types.
Positions are processed from the last to the first, so closing positions does not skip any in the list.
It checks that algo trading is allowed before sending any request.
It does not open trades and does not touch pending orders.

Recommended: any symbol, any timeframe.
Previous Day High/Low with First Touch Marker Previous Day High/Low with First Touch Marker

Draws the previous day's high and low over each day and marks the first touch of each level, with an optional alert.

EA Safety Check - scan EA source for DLLs, data leaks and martingale EA Safety Check - scan EA source for DLLs, data leaks and martingale

Static safety scan of EA/indicator source: DLL imports, programs started, account data sent online, hidden text, martingale, SL = 0.

Account Information Panel with Daily P/L and Equity Drawdown Account Information Panel with Daily P/L and Equity Drawdown

Shows balance, equity, margin, margin level, floating P/L, today's closed P/L and the drawdown from the equity peak in a small panel on the chart.

ATR Stop Distance and Risk-Based Lot Size Panel ATR Stop Distance and Risk-Based Lot Size Panel

Panel that shows the ATR of the last closed bar, a stop-loss distance derived from it, the money at risk for a chosen percentage of the balance and the lot size that matches that risk.