Exp_TrendEnvelopes
This EA trades based on the TrendEnvelopes custom indicator, opening buy positions when an upward trend signal is detected and sell positions when a downward trend signal is detected. It uses configurable money management with lot sizing or deposit share, and applies fixed Stop Loss and Take Profit levels to all trades. The strategy processes signals only on new bars to avoid redundant calculations.
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 of this EA is to follow trend direction using the TrendEnvelopes indicator for trading decisions. The TrendEnvelopes indicator is built on a moving average (supporting multiple MA methods, defaulting to EMA) with an ATR-based adaptive deviation to construct upper and lower envelopes. Entry conditions: a buy position is opened when the UpSignal buffer contains a valid value (non-zero and not EMPTY_VALUE), and a sell position is opened when the DnSignal buffer contains a valid value. When price is merely within the trend envelope (UpTrend or DnTrend valid without a new signal), only the opposite position is closed without opening a new one. Exit conditions include fixed Stop Loss and Take Profit in points, plus closing on reverse signals. Position sizing is controlled by the MM parameter, where negative values represent a fixed lot size and positive values represent a share of the deposit. Money management is handled through the BuyPositionOpen and SellPositionOpen functions from TradeAlgorithms.mqh, which incorporate signal timestamps, slippage control, and stop loss/take profit settings. The strategy only recalculates signals on new bar formations or when SignalBar is set to 0, reducing unnecessary frequent trading activity.
Strengths
- Uses new bar detection to avoid redundant signal processing and excessive trading, reducing overtrading risk
- Provides flexible money management via MM parameter, supporting both fixed lot size and deposit share modes
- Allows independent control of buy/sell open and close permissions via boolean parameters, offering high flexibility
- Uses ATR-adaptive deviation to construct trend envelopes, automatically adjusting channel width based on market volatility
Weaknesses
- Depends on external TradeAlgorithms.mqh library and TrendEnvelopes custom indicator with no fallback logic; EA cannot run if these files are missing
- Stop Loss and Take Profit are fixed point values without dynamic ATR-based adjustment, which may perform inconsistently across different volatility environments
- Lacks spread filter and trading session filter, potentially opening positions during high-spread periods or unfavorable trading hours
- No explicit position check logic in the main code, relying entirely on external library functions to prevent duplicate openings
Possible improvements
- Add ATR-based dynamic Stop Loss/Take Profit calculation instead of fixed points, making risk management more adaptive to market volatility changes
- Add spread filter and trading session filter to avoid opening positions under unfavorable conditions
Risk assessment
Overall risk: Medium
- Depends on external library and indicator files; missing files may cause runtime errors or inability to trade properly
- Fixed Stop Loss/Take Profit does not account for market volatility changes; SL may be too wide in low volatility and too tight in high volatility
- No spread filter mechanism, potentially resulting in unfavorable fills during low liquidity or widened spread conditions
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
MM | -0.1 | Deposit ratio or fixed lot size (negative=fixed lots) |
StopLoss_ | 1000 | Stop loss in points |
TakeProfit_ | 2000 | Take profit in points |
Deviation_ | 10 | Maximum price deviation in points (slippage tolerance) |
BuyPosOpen | true | Allow buy position opening |
SellPosOpen | true | Allow sell position opening |
BuyPosClose | true | Allow buy signal to close sell positions |
SellPosClose | true | Allow sell signal to close buy positions |
InpInd_Timeframe | PERIOD_H4 | MomentumCandleSign indicator timeframe |
MA_Period | 14 | Moving average period |
MA_Method | MODE_EMA | Moving average method |
Applied_Price | PRICE_CLOSE | Applied price type |
Deviation | 0.2 | Trend envelope deviation |
ATRPeriod | 15 | ATR indicator period |
ATRSensitivity | 0.5 | ATR offset sensitivity |
SignalBar | 1 | Bar index for trade signal |
Similar Trend Following EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.