my_ts15
This EA is a trailing stop utility that modifies existing position stop-losses based on a Moving Average line and price distance parameters. It does not open any new positions itself but can close positions when the stop-loss exceeds a maximum allowed distance. The trailing logic dynamically adjusts between MA-based and price-based trailing depending on whether the position is in profit or loss.
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
The core strategy concept of this EA is using a Moving Average as dynamic support/resistance to trail stop-losses, implementing trend-following profit protection. Regarding entry conditions, this EA does not open positions; it only manages stop-losses of existing positions. Exit conditions are twofold: first, when price hits the dynamically trailed stop-loss level, the position is closed by the SL order; second, when a position's loss exceeds max_sl points and pre_init is enabled, the position is forcibly closed. For position sizing, this EA does not handle lot sizes for new trades; it only modifies stop-loss and take-profit of existing positions. For money management, the max_sl parameter provides a maximum stop-loss cap to prevent excessive single-trade losses. The trailing stop logic distinguishes between profitable and losing states: when profitable, a tighter trail_behind_price distance is used; when in loss, a wider trail_behind_negative distance is applied, while the MA line serves as an alternative trailing benchmark, choosing the more favorable of the two.
Strengths
- Dual-mode trailing stop: uses both MA line and price distance as benchmarks, choosing the better value for more flexible stop protection
- Profit/loss state differentiation: tightens trailing distance when profitable, widens it when losing, avoiding premature stop-outs during pullbacks
- Maximum stop-loss cap: pre_init and max_sl parameters limit maximum single-trade loss, providing basic risk control
- Bidirectional support: implements symmetric trailing stop logic for both long and short positions
- Visual MA line: can display the MA indicator on the chart for intuitive judgment of trailing stop placement
Weaknesses
- No new bar check: trailing logic executes on every tick, potentially sending frequent modification requests, increasing server load and rejection risk
- No spread filter: with wide spreads, the trailing stop may be triggered immediately, causing unnecessary stop-outs
- PositionModify return value unchecked: success of PositionModify calls is not verified, potentially missing stop-loss modifications through silent failures
- Current symbol only: hardcoded _Symbol filter prevents cross-instrument position management
- trail_step of 0 may cause modification requests on every tick even when stop-loss change is negligible
Possible improvements
- Add new bar check or minimum time interval check to avoid executing stop-loss modification logic on every tick
- Check return values of PositionModify and PositionClose to handle trade request failures
- Add spread filter and minimum stop-level distance check to ensure stop-loss complies with broker's minimum stop level requirements
- Add OnTradeTransaction callback to monitor whether stop-loss modifications are actually executed successfully
Risk assessment
Overall risk: Low
- Executing stop-loss modifications on every tick may lead to frequent request rejections by the server
- Unchecked trade operation return values mean stop-loss modifications may silently fail, leaving positions unprotected
- The forced close feature (pre_init) may not execute at expected price during fast markets due to slippage
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
TS_ma_period | 50 | Moving average period |
TS_ma_shift | 0 | MA shift |
TS_ma_method | MODE_LWMA | MA smoothing type (Linear Weighted Moving Average) |
TS_applied_price | PRICE_WEIGHTED | MA applied price type (Weighted price) |
TS_show | true | Show indicator line |
pre_init | false | Enforce maximum stop loss limit |
max_sl | 100 | Maximum stop loss limit in points |
MA_bars_trail | 1 | MA trailing signal lookback bar count |
trail_behind_MA | 5 | Trailing stop points behind the MA |
trail_behind_price | 30 | Trailing stop points behind price when in profit |
trail_behind_negative | 60 | Trailing stop points behind price when at loss |
trail_step | 0 | Trailing stop minimum adjustment step |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.