Smart Take Loss Manager
- Utilità
- SERGUEI PROKHOROV
- Versione: 1.0
- Attivazioni: 20
Advanced Take-profit Stop-loss EA v1.00 — Expert Advisor Description
===================================================================
Overview:
---------
This Expert Advisor (EA) automatically monitors and closes positions based on overall profit or loss levels.
Its primary goal is to help traders manage risk and lock in gains by defining thresholds for take-profit and stop-loss
either globally or per individual symbol.
Key Features:
-------------
1. **Global and Per-Symbol Thresholds:** You can set a single global profit/loss threshold or define customized rules
for specific symbols using the `CustomizedSettings` input.
2. **Direction Filter:** Choose whether to apply logic only to Buy orders, Sell orders, or both.
3. **Profit/Loss Filter:** Focus only on profitable, losing, or all positions when calculating the total net result.
4. **Concerned Mode:** Define whether all open trades for a symbol should be closed when the threshold is hit, or
only the trades that meet the direction and P/L filter criteria.
5. **Visual Feedback:** Real-time display of per-symbol net P/L on the chart, including thresholds and currency.
6. **Timer-Based Checking:** The EA checks positions every X seconds (default: 10 seconds) using the `Ping` interval.
Inputs Breakdown:
-----------------
- `GlobalTakeLoss` (double): Total profit or loss level that triggers closure. If set to 0, per-symbol settings apply.
- `GlobalOrderDirection` (enum): Filter by direction — Buy, Sell, or Both.
- `ProfitLossAllOrders` (enum): Choose whether to consider only profit, only loss, or all positions.
- `ConcernedMode` (enum): Whether to close all trades for a symbol or only those that meet filters.
- `CustomizedSettings` (string): A powerful string input for configuring symbol-specific rules.
- `Ping` (int): Interval (in seconds) for how often the EA evaluates conditions.
CustomizedSettings Format:
--------------------------
This field allows symbol-specific rules using a semicolon-separated format:
```
"SYM,B/L/A,P/L/A,C/A,Threshold;..."
```
Where:
- `SYM`: Symbol name (e.g. EURUSD)
- `B/L/A`: Direction — B (Buy), S (Sell), A (All)
- `P/L/A`: Profit/Loss filter — P (Only Profit), L (Only Loss), A (All)
- `C/A`: Concerned filter — C (Only Concerned positions), A (All positions)
- `Threshold`: Profit/loss value to trigger closure (positive = TP, negative = SL)
Example:
```
"EURUSD,B,P,C,15.0;USDJPY,A,L,A,-10.0"
```
- EURUSD: Only Buy trades that are in profit, close only those when total profit exceeds $15.
- USDJPY: All trades that are in loss, close **all** trades for USDJPY if total loss exceeds $10.
How It Works:
-------------
1. Every Ping seconds, EA scans all open positions.
2. It groups trades by symbol and applies global or per-symbol rules.
3. If net profit/loss exceeds threshold, it closes either all or filtered trades based on settings.
4. Displays P/L data on chart using labels.
Use Case:
---------
This EA is ideal for managing basket trades, locking in total profit or minimizing losses across multiple positions
per symbol or account-wide, while offering customizable filtering.
