CloseIfProfitorLoss with Trailing Closing Positions Using Total Profit/Loss, with Trailing Stop.
| 💰 CloseIfProfitorLoss with Trailing for MetaTrader 4 & MetaTrader 5 Professional panel for closing positions by total profit or loss in deposit currency, points, percent of balance, and with Profit Trailing. CloseIfProfitorLoss helps traders control open positions, protect account results, close baskets of trades, trail floating profit, and use virtual profit/loss limits for manual trading or Expert Advisor portfolios. |
[Русский] - [English] - [Español] - [Português] - [Deutsch] - [Français] - [한국어] - [日本語] - [中文] - [Türkçe] - [Italiano]
| 💎 CloseIfProfitorLoss MT4 | 💎 CloseIfProfitorLoss MT5 |
| ⬇ Download CLP DEMO + PDF | 📘 Full Instruction |
| ▶ Watch Video | 🎛 Part of VirtualTradePad System |
| 🏠 Main | 🎓 Documentation | ⚙ Settings |
| ❓ FAQ | ⭐ Reviews | 💬 Comments |
🎬 Watch How CloseIfProfitorLoss WorksThe video shows how the panel can close positions by total profit or loss and use Profit Trailing to protect floating profit instead of closing too early. |
💰 CloseIfProfitorLoss for MT4 and MT5One practical panel for both MetaTrader 4 and MetaTrader 5: close positions by total profit, total loss, points, percent, deposit currency, or trail floating profit. |
🚀 What is CloseIfProfitorLoss?
CloseIfProfitorLoss, also known as Profit or Loss Pad or CLP, is an Expert Advisor panel for MetaTrader 4 and MetaTrader 5 that closes positions when the total profit or loss reaches the value selected by the trader.
The panel can monitor the current symbol or all symbols, calculate profit and loss in deposit currency, points, percent of balance, and close positions automatically when the selected condition is reached.
This product is especially useful for traders who manage several positions, use grids, baskets, manual trading, another Expert Advisor, recovery systems, averaging, hedge positions, or need a global virtual Take Profit / Stop Loss for a group of trades.
CloseIfProfitorLoss is not a signal robot. It does not decide where to buy or sell. Its task is different: control the result of already opened trades and close them according to your risk and profit rules.
💵 Close by ProfitClose positions when total profit reaches a selected value in money, points or percent. | 🛑 Close by LossClose positions when total loss reaches your protection limit. |
📈 Profit TrailingLet profit grow and close only after floating profit rolls back from the best reached level. | 🎛 Flexible ModesWork with all symbols, current symbol, BUY/SELL directions separately, or every order separately. |
🖥 Profit or Loss Pad Working ExampleThe panel monitors the selected positions and can close them automatically when profit or loss conditions are reached. |
⭐ Why Traders Use CLP
- Close total profit automatically when the account, symbol, direction or order reaches the selected target
- Close total loss automatically to limit drawdown or stop an unwanted situation
- Use Profit Trailing instead of closing fixed profit too early
- Close by deposit currency, for example +10 USD or -100 USD
- Close by points for point-based trading systems
- Close by percent of balance for account-level risk and profit control
- Monitor all symbols or only current symbol
- Close BUY and SELL directions separately
- Use Separate Order mode as a virtual Stop Loss / Take Profit for each position
- Delete pending orders after closing if the setting is enabled
- Use Close ALL emergency button for fast manual closing
- Show future closing lines for total profit/loss levels on the chart
| ⚠ Important: CloseIfProfitorLoss closes trades according to your selected result levels. It does not reduce market risk by itself. Wrong profit, loss, percent, points, Magic number or symbol settings can close trades earlier or later than expected. |
🧠 Main Idea: Control the Basket, Not Only One Trade
Many traders open more than one position: manual trades, Expert Advisor trades, grids, recovery series, hedge positions or several symbols at the same time.
In this situation, a normal single-position Stop Loss or Take Profit is not always enough. The trader may need to close the total result:
- close everything when the basket reaches +50 USD;
- close all current-symbol trades at -100 USD loss;
- close BUY direction separately when BUY profit reaches +20 USD;
- close each order separately by its own profit/loss level;
- trail total profit after it reaches the selected target;
- close all trades when loss reaches a percent of account balance.
CloseIfProfitorLoss was created exactly for this type of practical control.
| ✅ Main value: CLP gives the trader a clear panel for closing positions by total profit/loss rules instead of manually watching floating results all day. |
🎛 Main Panel Modes
The panel allows you to decide what exactly should be monitored and closed. This is one of the strongest features of CLP because different traders need different closing logic.
| Mode | How it works |
| All Symbols | Calculates and closes positions across all symbols according to selected profit/loss rules. |
| Current Symbol Only | Calculates and closes only positions of the chart symbol where the EA is installed. |
| Separate BUY / SELL | BUY and SELL directions are calculated separately and can close independently. |
| Separate Order | Every position is calculated separately. This mode can work like virtual Stop Loss / Take Profit per position. |
| Close ALL | Emergency button for closing positions immediately according to selected symbol/mode logic. |
🎛 CLP Panel Control ExampleThe panel gives quick access to profit, loss, trailing and closing modes directly from the chart. |
💵 Closing by Profit
You can set a profit level and enable the type of profit calculation you need.
For example, you can close positions when:
- total profit reaches +10 USD;
- total profit reaches +100 points;
- total profit reaches +2% of current balance.
The profit value must be greater than zero. If zero is entered, the field will not work. If a negative value is entered into a profit field, the EA can automatically convert it to a positive value when auto-correction is enabled.
| Profit Mode | Meaning |
| Profit $ | Close when total profit reaches selected value in deposit currency. |
| Profit p | Close when total profit reaches selected point value. |
| Profit % | Close when total profit reaches selected percent of balance. |
🛑 Closing by Loss
You can also set a loss level and allow CLP to close positions when the loss reaches your selected limit.
This can be used as a global protection rule for a basket, direction, current symbol, all symbols or separate position mode.
The loss value must be lower than zero. If a positive value is entered into a loss field, the EA can automatically convert it to a negative value when auto-correction is enabled.
| Loss Mode | Meaning |
| Loss $ | Close when total loss reaches selected negative value in deposit currency. |
| Loss p | Close when total loss reaches selected negative point value. |
| Loss % | Close when total loss reaches selected percent of balance. |
| ⚠ Correct values: profit values should be positive, loss values should be negative. This prevents confusion between “close in profit” and “close in loss” logic. |
📈 Profit Trailing: Let Profit Grow Before Closing
The strongest part of CloseIfProfitorLoss is Trailing Profit.
Without trailing, if you set Profit $ = 10, the EA closes positions immediately when total profit reaches 10 dollars. This is simple, but sometimes the market continues moving in your favor and the trader loses potential extra profit.
Profit Trailing solves this by activating only after the selected profit level is reached. The EA remembers the best floating profit level and moves the closing line after profit. If profit then falls below the trailed level, the EA closes positions.
| Step | Example with Profit $ = 10 and TrailingProfit = 5 |
| 1 | The profit target is 10 USD. |
| 2 | The trailing line starts at 5 USD. |
| 3 | When total profit rises above 10 USD, trailing becomes active. |
| 4 | If floating profit rises to 20 USD, the trailing line follows behind it. |
| 5 | If profit rolls back below the last trailed level, the EA closes positions. |
📈 Trailing Profit LogicTrailing Profit allows the EA to protect the best reached floating profit instead of closing immediately at the first target. |
📊 Profit Trailing in Percent
Profit Trailing can work not only in deposit currency, but also in percent.
For example, if Profit % is set to 2 and TrailingProfit is set to 1, the EA starts trailing after profit reaches 2% of balance. The trailing level is placed at 1%. If profit grows to 2.01%, the trailing level can move to 1.01%, and so on.
If the profit later falls below the trailed level, positions are closed.
| Parameter | Example |
| Profit % | 2% |
| TrailingProfit | 1% |
| CLP_TralOptionsStep | 0.01% trailing step, if you want finer updates |
📊 Example of Trailing Profit in PercentThis mode is useful when the trader wants profit control based on account balance percentage instead of fixed money values. |
💵 Profit Trailing in Deposit Currency and Separate BUY / SELL
Profit Trailing can also work in deposit currency and separately for BUY and SELL directions.
This is useful when one direction is profitable and the other direction is still negative. With Separate BUY / SELL enabled, BUY profit can be closed or trailed independently from SELL positions.
For example, if BUY profit reaches +5 USD and TrailingProfit is 1 USD, the trailing line can start from +4 USD. If BUY profit rises to +6 USD, the trailing level moves to +5 USD. If BUY profit falls below the trailed level, BUY positions can be closed while SELL positions are calculated separately.
💵 Trailing Profit in Deposit Currency with Separate DirectionsSeparate BUY / SELL monitoring is useful when directions must be controlled independently. |
🧩 Separate Order Mode: Virtual Stop Loss and Take Profit
Separate Order mode calculates each position separately. This can work like a virtual Stop Loss or virtual Take Profit for every individual trade.
Instead of closing a whole basket, the EA checks each position independently and closes it when the selected profit or loss rule is reached.
This mode can be useful for manual trading when the trader wants flexible result-based closing without placing visible broker-side Stop Loss or Take Profit levels.
| Mode | Use case |
| Separate Order OFF | The EA calculates basket or direction result according to selected mode. |
| Separate Order ON | Each position is calculated and closed separately, like virtual SL/TP. |
🌐 Current Symbol or All Symbols
CloseIfProfitorLoss can monitor only the current chart symbol or all symbols in the account.
Current Symbol mode is useful when you want independent control for each trading pair. All Symbols mode is useful when you want account-level basket control, for example closing everything when total account profit reaches a selected amount.
| Calculation Mode | Meaning |
| Current Symbol | Only positions of the chart symbol are calculated and closed. |
| All Symbols | Positions from all symbols are included in total profit/loss calculation. |
📍 Future BE / TP / SL Lines
The option Show_Future_BE_TP_SL can show future closing levels on the chart. These lines help estimate where the price must go for the selected profit or loss rule to trigger closing.
The lines can be shown separately for BUY and SELL positions or as a common level, depending on the mode.
This feature works on the current symbol and when Separate Order mode is disabled. If lines are not shown, the positions may form a lock that cannot be closed by a simple total profit or loss line.
📍 Future Closing Lines Future lines help visualize possible basket closing prices for profit or loss rules. |
| ⚠ Price note: line and price data can be approximate with floating spread. Remember that SELL positions close by ASK and BUY positions close by BID. |
🧮 Points Calculation and Lot Weight
CLP can calculate result in points. But when several positions have different lots, pure point distance can be misleading.
For example, one position with 0.01 lot and another position with 0.02 lot cannot be treated as equal in money risk. A 10-point move on 0.02 lot has twice the financial effect of a 10-point move on 0.01 lot.
The setting Use_Lots_in_CLP_Points allows the EA to calculate points with lot weighting. This is especially useful on hedge accounts where several positions can have different volumes.
| Setting | Meaning |
| Use_Lots_in_CLP_Points = false | The EA calculates “clean” points without lot weighting. |
| Use_Lots_in_CLP_Points = true | The EA calculates points with lot weight based on minimum lot logic. |
| Practical example: two positions can show positive “clean” points but still have a money loss if the losing position has a larger lot. That is why lot-weighted point calculation can be important. |
🪄 Auto-Correction of Profit and Loss Values
The setting AutoCorrect_LevelCLP helps protect the user from wrong sign input.
In profit fields, the value must be positive. In loss fields, the value must be negative. If auto-correction is enabled, the EA can automatically convert wrong signs to correct ones.
| User Input | Auto-corrected Meaning |
| Profit = -100 | Converted to +100 for profit closing. |
| Loss = +100 | Converted to -100 for loss closing. |
| TrailingProfit negative | Rejected or corrected depending on EA logic because trailing distance must be positive. |
⚙ Main Settings You Should Understand
CloseIfProfitorLoss has many settings because it can work as a basket closer, loss limiter, virtual TP/SL, profit trailer and account-control panel. The full list is available in the product documentation, but these groups are the most important.
| Setting | Why it matters |
| MagicNumber | Defines which Magic numbers are monitored and which Magic number is used when opening positions from the panel. |
| UseAllMagicFromAllAccount | If true, all positions on the current symbol can be monitored regardless of Magic number. |
| Show_Future_BE_TP_SL | Shows future break-even, profit and loss levels on the chart. |
| CLP_TralOptionsStep | Step for changing the trailing profit level in selected units: money, points or percent. |
| CLP_DeleteStopOrders | Deletes pending orders when closing by total profit or loss. |
| Use_Lots_in_CLP_Points | Includes lot size in point calculation for more realistic point-based profit/loss logic. |
| AutoCorrect_LevelCLP | Automatically corrects profit/loss value signs to prevent wrong input. |
| CPL_AlerT | Shows an alert when closing by profit or loss occurs. |
| CPL_Mail | Sends an email notification when closing by profit or loss occurs. |
| CPL_Push | Sends a push notification to the mobile terminal when closing occurs. |
| CPL_CloseTerminalAfterClose | Closes the terminal after all positions have been closed. |
| CPL_AUTOOFF_AfterClose | Automatically turns off the Close if Profit or Loss button after all relevant positions are closed. |
| TypeFilling | MT5 filling type. Useful if the broker returns invalid filling mode errors. |
| 📘 Want the full parameter list? Open the complete CloseIfProfitorLoss Settings documentation before using advanced Magic, trailing, future lines, alerts or loss-limit scenarios. |
🔔 Alerts, Push, Mail and Terminal Actions
CLP can notify the trader when closing by profit or loss happens.
This is useful when the panel runs on VPS, manages several positions or works together with another Expert Advisor. Notifications can help the trader know when the result-control rule has been triggered.
| Notification | Purpose |
| CPL_AlerT | Shows an alert on the terminal chart. |
| CPL_Mail | Sends email if MetaTrader mail is configured. |
| CPL_Push | Sends push notification to the mobile MetaTrader app. |
| CPL_CloseTerminalAfterClose | Can close the terminal after all positions have been closed. |
📉 Limit Alerts for Day, Week, Month or All Time
CloseIfProfitorLoss can also include a limit alert block. This block does not close trades by itself. It gives alerts when selected profit or loss limits are reached for a chosen period.
This is useful if the trader wants to be notified when total result for the day, week, month or all time reaches a selected value.
| Limit Setting | Meaning |
| LimitFor | Period for limit calculation: day, week, month or all time. |
| LimitForLosses | Loss limit in deposit currency for alerting. |
| LimitForProfits | Profit limit in deposit currency for alerting. |
| NotificationMailSend | Enables messages when selected limits are reached. |
🧪 Example of Consistent Work
The panel can be used step by step: select the symbols, choose profit/loss units, enable closing modes, set profit and loss values, activate Close if Profit or Loss, and wait until the selected level is reached.
The following examples show different stages of work with the panel and result-control logic.
🧪 Example Step 1 |
🧪 Example Step 2 |
🧪 Example Step 3 |
🧪 Example Step 4 |
✅ When CloseIfProfitorLoss Can Be Useful
- You trade manually and want automatic closing by total profit or loss.
- You use another Expert Advisor but need external basket protection.
- You manage several positions on one symbol and want common closing logic.
- You need account-level closing across all symbols.
- You want to close BUY and SELL directions separately.
- You want each position to close separately by virtual profit/loss levels.
- You want to trail floating profit after it reaches a selected threshold.
- You want visible future closing levels on the chart.
- You want notifications when closing by profit or loss happens.
- You need a fast Close ALL button for emergency situations.
⚠ When You Must Be Careful
|
🌐 Broker, VPS and Terminal Recommendations
CloseIfProfitorLoss works with closing commands, basket monitoring, pending order deletion and profit/loss calculations. Stable execution and terminal uptime are important.
✅ Recommended
| ⚠ Check Carefully
|
🛠 How to Install and Start CLP
Installation is standard for MQL5 Market products. After installation, attach the EA to the chart, configure the closing rules, select the symbols/mode and activate the panel.
| Step | Action |
| 1 | Download, buy or rent CloseIfProfitorLoss for MT4 or MT5. |
| 2 | Open MetaTrader and log in to the MQL5 account used for the product. |
| 3 | Install the product from the Market section of the terminal. |
| 4 | Attach the EA to the chart of the symbol you want to monitor. |
| 5 | Enable Algo Trading / Auto Trading and allow automated trading in EA settings. |
| 6 | Select Current Symbol or All Symbols mode. |
| 7 | Select whether BUY and SELL should be calculated together or separately. |
| 8 | Set profit and loss values in money, points or percent. |
| 9 | Enable Trailing Profit if you want floating profit to be trailed. |
| 10 | Turn ON Close if Profit or Loss and monitor the panel on demo before real use. |
🔗 Useful Links🔹 Buy CloseIfProfitorLoss for MetaTrader 4 🔹 Buy CloseIfProfitorLoss for MetaTrader 5 🔹 Full CloseIfProfitorLoss Instruction |
🆚 CLP vs Manual Closing
Manual closing is possible, but it requires constant monitoring. The trader must watch floating profit, calculate total result, decide when to close, and react quickly when the market moves.
CloseIfProfitorLoss automates this process through clear rules.
| Manual Closing | CloseIfProfitorLoss |
| Trader watches floating profit manually | EA monitors selected result levels automatically |
| Hard to close many trades at the right moment | EA can close basket, direction, symbol or all symbols by rule |
| Profit is often closed too early | Profit Trailing can let floating profit grow |
| Loss limit may be missed during fast movement | EA can close when selected loss level is reached |
| Different lots make point calculation confusing | Lot-weighted point calculation can be enabled |
📌 Practical Recommendations Before You Start
- Start with demo testing.
- Use Current Symbol mode first before using All Symbols mode.
- Check MagicNumber and UseAllMagicFromAllAccount carefully.
- Use positive values for profit and negative values for loss.
- Enable AutoCorrect_LevelCLP to reduce input mistakes.
- Test Profit Trailing with small values before using it on real accounts.
- Use Separate BUY / SELL only when you want directions to close independently.
- Use Separate Order only when you understand individual virtual TP/SL logic.
- Enable CLP_DeleteStopOrders only if you want pending orders removed after closing.
- Use VPS if the panel must monitor positions continuously.
⚠ Risk Warning
| Trading Forex and CFDs involves risk. CloseIfProfitorLoss is a trade-management and closing utility. It can close positions by selected profit/loss rules and trail floating profit, but it cannot guarantee profit or prevent all losses. Market gaps, slippage, broker delays, spread widening, connection problems and incorrect settings can affect the final result. |
🏁 Final Thoughts
CloseIfProfitorLoss with Trailing is created for traders who need structured control over open positions and account result.
It is especially useful when you trade several positions, use grids, manage baskets, work with manual trades, use another Expert Advisor or need a global profit/loss control panel.
The most powerful feature is Profit Trailing: instead of closing immediately at the first profit target, the panel can follow floating profit and close only after a rollback. This gives traders a more flexible way to protect profits while still giving the market room to continue.
🚀 Start Using CloseIfProfitorLoss TodayDownload the demo, watch the video, read the full instruction, configure your profit/loss rules and test CLP on a demo account before real trading. |
| ▶ Watch Video | 📘 Full Instruction |
| 💎 Buy CLP MT5 | 💎 Buy CLP MT4 |
| ⬇ Download DEMO + PDF | 🛒 All Expforex Products |
SEO Tags
CloseIfProfitorLoss, Close if Profit or Loss, Profit or Loss Pad, CLP, Close Profit, Close Loss, Total Profit, Total Loss, Trailing Profit, Profit Trailing, basket close Expert Advisor, close positions by profit, close positions by loss, close all positions, MetaTrader profit closer, MT4 profit closer, MT5 profit closer, Forex basket closer, virtual take profit, virtual stop loss, close by percent, close by points, close by deposit currency, Separate BUY SELL, Separate Order, All Symbols closing, Current Symbol closing, Close ALL button, Forex trade management, Expforex CLP, MQL5 Market Expert Advisor














