Apex Trends
- Experts
- 버전: 1.13
- 활성화: 10
APEX TRENDS MT5 is a trend-following Expert Advisor that trades a small portfolio of markets from one account: gold (XAUUSD) and crypto (BTCUSD, ETHUSD), with a configurable instrument list. It trades both directions — long in uptrends, short in downtrends — and filters its own entries by market regime.
The EA does not use grid, martingale, averaging, or hedging. Every trade is independent, protected by a stop-loss from entry, and followed by an ATR-based trailing stop.
The strategy is built on a Donchian channel breakout, confirmed by an EMA trend filter, ADX strength, and +DI / −DI direction, and gated by a higher-timeframe (D1) regime filter. This is a selective approach: the EA does not trade constantly — it waits for the right conditions and enters only when all filters align.
Strategy Logic
- Entry — long (mirror for short):
- Breakout of the Donchian channel (20 bars, shifted by 1).
- EMA(20) > EMA(50) and price > EMA(200).
- ADX(14) ≥ 20 and +DI > −DI (for shorts: −DI > +DI).
- D1 regime filter: daily EMA(200) rising with ADX(14) ≥ 25 (short side mirrored).
- Position management:
- Stop-loss: 2 × ATR(14) from entry price.
- Trailing: 4 × ATR from the highest close since entry (updated on the close of a new bar).
- EMA exit: close below EMA(20) on reversal.
- Stops-level aware and market-session aware (no modify/close attempts when the market is closed or at rollover).
Portfolio Risk Management
- Hard portfolio ceiling — the sum of open risk across all legs cannot exceed InpPortfolioRiskMax (the "1% × 3 = 3%" case is no longer possible). Effectively a cap on the number of simultaneous 1%-risk legs (2.0 ≈ two legs).
- Correlation adjustment — an optional extra weight for the BTC/ETH pair ( InpCorrBTCETH ). On the tested history (2015–2026) BTC and ETH were never open simultaneously at an entry, so this branch never fired: it ships as dormant insurance, unverified, not as a proven feature.
- Account drawdown guard — new entries pause at InpMaxDDPercent . This is a safety net, not a performance knob (it did not trigger at the default 25% on the tested history). A time re-arm ( InpDdRearmHours ) automatically clears the halt so it cannot dead-lock.
- Observability — gate, halt and re-arm events are logged ( InpLogRiskSkips ), so the mechanism is visible in the journal instead of assumed.
- Risk is measured correctly: distance-to-stop × tick value × volume (not margin).
Risk Management (per trade)
- Fixed risk per trade — 1% of equity by default; lot size from the stop distance (2 × ATR).
- Free margin / market-mode check before every entry.
- Symbol aliases resolved automatically (XAUUSD/GOLD, BTCUSD/BITCOIN, ETHUSD/ETHEREUM and common suffixes); missing instruments are skipped silently.
- Drawdown peak is persisted across terminal restarts (live), so the halt logic survives a VPS reboot.
Portfolio by design
- One account, multiple uncorrelated legs. Correlation of gold to crypto is close to zero, which raises risk-adjusted return versus a single instrument.
- Only trending, low-correlation instruments should be added; ranging markets (most FX, index shorts) dilute performance.
Backtest Results Portfolio XAUUSD+BTCUSD, H4, long+short, D1 filter, risk 1%, deposit 10 000, model "1 minute OHLC":
- 2015–2026: Net ≈ +442%, Profit Factor ≈ 1.9, Sharpe ≈ 2.2, Max Drawdown ≈ 12.6%.
- Out-of-sample 2021–2026: Sharpe ≈ 1.7, Profit Factor ≈ 1.7.
- Walk-forward: 6 of 6 two-year windows positive.
- Monte-Carlo: actual drawdown within the simulated band (not in the worst 5%).
- Regime stress: gold flat (2015–2017) +; crypto crash (2018) +; choppy 2022 ≈ breakeven.
- Portfolio ceiling (cap 2%): within noise of the un-limited run (+906 net over 11 years, 2 trades) — it did not worsen performance and added a hard ceiling. A tighter cap (1%) cut drawdown to ~9.7% but also reduced net/Sharpe and is not validated out-of-sample. Caps are chosen by drawdown tolerance, not by Sharpe.
- Per-leg (single instrument, H4, D1 filter): XAUUSD PF ≈ 1.6; BTCUSD PF ≈ 2.1; ETHUSD PF ≈ 1.5. Past performance does not guarantee future results. Drawdowns are inevitable. Plan your risk accordingly.
Operating modes
- Recommended: H4 — fewer trades, lower drawdown. H1 is possible but more aggressive.
- Run the default portfolio (XAUUSD,BTCUSD,ETHUSD) if your broker offers crypto; otherwise set the list to the instruments you have (e.g., XAUUSD).
Performance
- Heavy indicator work runs once per closed bar; entry retries are throttled. Real-tick backtests of the portfolio complete in minutes, not hours.
Important notes (live vs backtest)
- The trailing stop updates on the close of a new bar (not intrabar). On H4 it can lag by up to ~4 hours.
- The EA runs on OnTick of the CHART symbol. If the chart symbol is closed (e.g. gold on weekends) there are no ticks, so crypto legs open over the weekend are not managed until Monday. Attach the EA to a symbol that trades when you need management, or accept this gap.
- Portfolio risk per leg is measured as (entry → current stop) × value; a leg whose stop has trailed above entry counts as zero risk. Once all legs are protected, the entry ceiling stops blocking (intentional).
- On small accounts the minimum lot can force risk above the target; this is logged ("lots clamped to min").
Technical Details
- Platform: MetaTrader 5
- Instruments: XAUUSD, BTCUSD, ETHUSD (configurable)
- Timeframes: H4 (recommended), H1
- Minimum deposit: 1 000 USD (at 1% risk; more for full portfolio)
- Leverage: 1:100 recommended
- Broker: low-spread / ECN / RAW
- VPS: recommended (ping < 50 ms)
- Self-contained: no DLLs, no external files, one .mq5 file
Not Used: martingale, grid, averaging, hedging.
Input Parameters
- InpSymbols — portfolio instrument list (e.g., XAUUSD,BTCUSD,ETHUSD).
- InpRiskPercent — risk per trade, % of equity (1.0).
- InpAllowShorts — allow short trades (true).
- InpUseRegimeFilter — enable D1 regime filter (true).
- InpRegimeAdxMin — minimum D1 trend strength to enter (25).
- InpBreakoutN — Donchian breakout lookback (20).
- InpEmaFast — fast EMA (20).
- InpEmaSlow — medium EMA (50).
- InpEmaTrend — trend EMA (200).
- InpEmaExit — EMA used for exit (20).
- InpAtrPeriod — ATR period (14).
- InpAdxPeriod — ADX period (14).
- InpAdxMin — minimum ADX on the working TF (20).
- InpSlATR — stop-loss size in ATR (2.0).
- InpTrailATR — trailing-stop size in ATR (4.0).
- InpMaxDDPercent — drawdown halt threshold, % (25). Safety net, not a Sharpe knob — change only after a new walk-forward.
- InpDdRearmHours — hours to auto-clear the halt (168 = 1 week). Dormant at the default cap; change only together with the cap.
- InpMaxSpreadPts — max spread in points to enter (0 = off).
- InpRiskMode — 0 = off, 1 = hard cap, 2 = correlation-adjusted (2).
- InpPortfolioRiskMax — max total open risk, % (2.0 ≈ two 1%-legs).
- InpCorrBTCETH — correlation weight for BTC/ETH (0.7). Dormant/unverified on tested data.
- InpLogRiskSkips — log gate/halt/re-arm events (true).
- InpSkipRollover — skip entries at rollover hour (true).
- InpRolloverHour — rollover hour, server time (23).
- InpMagic — trade identifier (6041).
- InpSlippage — allowed slippage in points (30).
Recommendations Before You Start: test on demo ≥ 3 months; start at 0.5% risk; move to 1% only after stable results; use a VPS; do not change parameters without a new walk-forward; always load the supplied .set file (the MT5 tester retains previous inputs between runs).
Support: via the built-in MQL5 chat.
Disclaimer: Trading gold, crypto and CFDs involves significant risk and may not be suitable for every investor. Past results do not guarantee future results, and losses are possible. Results may vary between brokers and accounts due to differences in execution, spreads, slippage, liquidity, and technical infrastructure. The portfolio risk ceiling, correlation weight and drawdown halt are risk-control mechanisms; on the tested history the correlation branch and the default drawdown halt did not trigger, so their benefit is not proven and their live behaviour may differ. No system can fully eliminate trading risk or guarantee identical results. The EA is selective by nature: in some periods there may be few trades or none at all. Testing on a demo account is strongly recommended before using real funds.
