Close all treads with Tp and SL
- Utilities
- Mir Mostofa Kamal
- Version: 1.1
Close_All_Trades_with_TP_SL is a reliable and efficient MQL4 Expert Advisor designed to simplify and automate trade management for all open positions on your MT4 account. This EA is especially useful for traders who open multiple trades quickly or use high-frequency strategies where manual TP/SL placement becomes difficult and time-consuming.
The primary purpose of the EA is to ensure that every open trade—whether Buy or Sell—always has a predefined Take Profit (TP) and Stop Loss (SL) applied. Many traders forget to set TP/SL after opening trades, or some EAs fail to attach them immediately. This EA eliminates those risks by automatically scanning all open trades at adjustable time intervals and applying TP/SL wherever missing.
The logic is lightweight, fast, and optimized for smooth performance, even on accounts with many simultaneous trades. It does not open or close trades on its own; instead, it acts as a trade protection and management tool. You maintain full control of your entries while the EA ensures safe exits.
Key Features
1. Automatic TP & SL Assignment
-
Instantly checks all open trades.
-
If a trade has no TP or SL, the EA adds them automatically.
-
Works for both Buy and Sell orders.
2. Adjustable TP and SL Values
-
Set your preferred Take Profit and Stop Loss in price (flat value).
-
Easily change the settings without modifying the code.
3. Interval-Based Checking System
-
Uses a time-based cycle (e.g., every 1 second).
-
Efficiently checks trades without stressing your terminal.
-
Ensures no trade remains unprotected for long.
4. Lightweight & Stable
-
Optimized to prevent heavy CPU usage.
-
Suitable for scalping, martingale, grid, or manual trading.
-
Runs smoothly in all MT4 environments.
5. Full Compatibility
-
Works with all brokers (ECN, STP, Market Maker).
-
Supports all currency pairs, commodities, indices, and crypto symbols.
-
Works on both 4-digit and 5-digit brokers.
6. Safe Trade Management
-
Ensures that unexpected market movements do not wipe your account due to missing SL.
-
Keeps trading consistent and disciplined.
7. No Trade Opening/Closing
-
EA does not open or close trades.
-
Only adds TP and SL to existing trades.
-
Perfect for traders who want protection without interference.
How It Works
-
Attach the EA to any chart (any timeframe).
-
Set the input values:
-
TakeProfitPrice
-
StopLossPrice
-
UseTakeProfit
-
UseStopLoss
-
CheckInterval (seconds)
-
-
The EA monitors all open trades.
-
If any trade has missing TP or SL, it applies them instantly.
-
The EA continues this cycle until removed from the chart.
Ideal For
-
Scalpers
-
Grid/Martingale traders
-
High-frequency manual traders
-
EA users whose robots sometimes miss TP/SL
-
Anyone who wants safer automated trade protection
Conclusion
Close_All_Trades_with_TP_SL is a simple yet powerful tool that enhances trading safety by ensuring all positions remain protected with consistent TP and SL levels. Its fast operation, customizable settings, and stable design make it a valuable addition to any MT4 trading setup.
