TrailingTakeProfit
This EA is a trailing take-profit utility that dynamically adjusts the take-profit level of existing positions as price moves in favor. It monitors open positions for a specified symbol and trails the TP behind the current price by a configurable distance once the price has moved beyond a starting threshold.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
This EA is not a standalone trading strategy but a position management utility. Its core concept is to activate a trailing take-profit mechanism once the floating profit on a position exceeds the TrailingTPStart threshold in points. It then keeps the take-profit level within TrailingTPDistance points of the current price. For buy positions, when the difference between the open price and current price exceeds the start threshold, and the current TP is above the current price plus the distance, it moves the TP down to the current price plus the distance value. For sell positions, the logic is reversed: when the current price minus the open price exceeds the start threshold, and the current TP is below the current price minus the distance, it moves the TP up to the current price minus the distance value. This EA does not generate any entry signals or open positions; it solely manages the take-profit of existing positions. Position sizing and money management are entirely the user's responsibility or handled by another EA. Regarding risk, this EA neither sets nor modifies stop-losses, only take-profits, and it does not handle order modification failures.
Strengths
- Clean and straightforward logic, easy to understand and maintain
- Supports trailing take-profit for both buy and sell positions
- Well-designed parameters with separate start threshold and trailing distance for flexibility
- Uses MQL5 standard library classes (CTrade, CPositionInfo, CSymbolInfo) for good code standards
Weaknesses
- Does not handle PositionModify call failures; order modifications may silently fail
- Critical logic error in buy position: PriceOpen()-PriceCurrent()>threshold triggers when price drops, opposite of trailing TP intent
- Lacks point value normalization; different symbols may have different point values without symbol-specific adaptation
- No re-entry prevention mechanism; attempts modification every tick, potentially increasing server load
- Does not handle zero stop-loss, potentially passing invalid SL values to PositionModify
Possible improvements
- Fix the buy position logic error: change to PriceCurrent()-PriceOpen()>STtp*Point() so trailing TP activates when price rises beyond the threshold, matching the intended behavior
- Add PositionModify return value checking and error handling, and verify whether SL/TP actually need changing before submitting modification requests
- Add price normalization using NormalizeDouble for proper price precision, and account for different symbols' minimum tick sizes
Risk assessment
Overall risk: Medium
- Critical logic error in buy position trigger condition may cause TP modification during loss rather than profit
- No order modification result checking; failures go undetected without retry capability
- Attempts modification every tick without throttling; high-frequency calls may trigger server rate limits or disconnection
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
TrailingTP_Mode | true | Trailing take profit mode toggle; true to enable |
Symbol_Name | GBPUSD | Trading symbol name to monitor |
TrailingTPStart | 200 | Trailing TP start threshold (points); begins trailing above this |
TrailingTPDistance | 200 | Trailing TP distance (points); max gap between TP and price |
Similar Utility EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.