Momentum Portfolio
- エキスパート
- バージョン: 17.60
Multi-symbol momentum expert advisor for gold, US indices, and bitcoin. Trades four instruments from a single chart with adaptive risk management, regime detection, and broker-agnostic symbol resolution.
Overview
Momentum Portfolio is a four-symbol expert advisor that trades XAUUSD, NAS100, US30, and BTCUSD using two complementary momentum-detection engines. A single instance attached to any H1 chart manages entries, exits, partial profit-taking, and risk control across all four markets independently. Each symbol has its own parameter set, its own regime-health tracker, and its own position lifecycle — there is no shared state that causes one symbol's behavior to compromise another's.
The EA is designed to run unattended on a small to mid-sized retail account and to work across the major retail brokers without manual ticker mapping.
Key Features
- Multi-symbol portfolio: trades XAUUSD, NAS100, US30, and BTCUSD from one chart
- Two entry engines: volatility-regime shift detection + session-open momentum
- Three-stage profit management: TP1 at 1R, TP2 at 2R with break-even lock, ATR-trailed runner
- Per-symbol regime detector: pauses trading on a symbol when its rolling win-rate or profit factor drops, resumes after confirmed recovery
- Smart time-stop: positions making meaningful progress are allowed to develop; stalled positions are closed
- Cross-broker compatibility: automatically resolves ticker variants (USTEC/NDX100/NAS100, DJ30/WS30/US30, BTC/BTCUSDT/BTCUSD, GOLD/XAUUSD) and common suffixes (.m, .r, +, .cash)
- Margin-aware position sizing: never opens an order the account cannot afford
- Market-state aware: respects broker-declared trading sessions, no "Market closed" errors during rollover windows
- Configurable per-symbol risk: independent ATR periods, ADX thresholds, lot sizing, and spread caps for each instrument
- Portfolio-level concurrency cap: configurable maximum of simultaneous positions across all symbols (default 3)
Markets and Timeframes
| Symbol | Primary Timeframe | Confirmation Timeframe |
|---|---|---|
| XAUUSD | H1 | H4 |
| NAS100 | H1 | H4 |
| US30 | H1 | H4 |
| BTCUSD | H1 | H4 |
Attach the EA to any H1 chart — the chart symbol does not need to be one of the four traded symbols. The EA detects which of the four your broker provides and trades only those.
Strategy
The EA combines two distinct entry mechanisms designed to capture different kinds of momentum.
Engine A — Volatility Regime Shift
Compares short-term ATR (5-period) against long-term ATR (20-period). When the short-term volatility expands meaningfully beyond the long-term baseline (configurable expansion factor, default 1.8×), the EA reads the direction of the expansion bar (close versus open) and enters in that direction. Stop-loss sits at the opposite extreme of the expansion bar plus an ATR buffer; target is 2× the stop distance.
Volatility-expansion entries tend to fire when a market is breaking out of consolidation — the moments where directional moves are most likely to continue.
Engine B — Session Open Momentum
Watches the first hours after a market's relevant session opens (London open for XAUUSD, New York open for the indices and BTC). If the price has moved by a configurable ATR-scaled amount during the lookback window, the EA enters in the direction of that move. A maximum-move filter skips entries during news-driven extreme bars. Target is 1.5× the stop distance, reflecting that session-open momentum tends to fade faster than volatility-expansion moves.
Each session fires at most once per day per symbol.
Engine C — Failed Pattern (optional, disabled by default)
Contrarian entries on failed Donchian breakouts. Backtest analysis showed this engine underperforms during persistent trends. It remains in the code for users who want to experiment with mean-reverting setups, but the default configuration leaves it off.
Position Management
Each open position uses a three-stage exit profile:
- TP1 (+1R) — Approximately 33% of the position closes. The original structural stop remains in place on the remainder.
- TP2 (+2R) — Another 33% closes. The stop moves to entry + 1R, locking in profit on the runner.
- Runner — Final ~34% trails with an ATR-based stop from the highest favorable price. Continues until either the trail stops it out or the smart time-stop fires.
The smart time-stop only closes a position if it has been held past the bar limit and is below a minimum-progress threshold (default 0.3R). Productive positions are not arbitrarily cut.
Risk Management
Per-symbol regime detector. Each symbol maintains a rolling 30-trade window of outcomes. If win-rate drops below 45% or profit factor below 1.0, that symbol pauses live trading while continuing to evaluate market conditions through shadow trades (virtual positions tracked but not sent to the broker). Trading resumes for that symbol after 8 confirming successful shadow or live trades. The other symbols continue trading normally.
ADX entry gate. Entries on any symbol require the entry-timeframe ADX(14) to be at or above the configured threshold (default 20). Periods of severe chop are filtered out.
Portfolio concurrency cap. Maximum simultaneous positions across all symbols (default 3). Prevents over-concentration when multiple symbols signal simultaneously.
Margin-aware lot sizing. Before sending any order, the EA queries OrderCalcMargin and caps the position size to a configurable percentage of free margin (default 50%). On small accounts where the desired lot size would exceed available margin, the EA reduces the order rather than failing. If even the broker's minimum lot is unaffordable, the entry is skipped.
Market-state safety. Three layers prevent "Market closed" rejections during broker rollover windows: a proactive broker-declared session check, a tick-age heuristic, and a reactive cooldown after any market-closed rejection. The EA does not spam orders into closed markets.
Re-entry cooldown. Configurable wait period after losses (default 6 bars) and wins (default 0 bars) on each symbol. Prevents immediate re-entry into deteriorating setups.
Recommended Setup
| Parameter | Recommendation |
|---|---|
| Account type | Hedging |
| Minimum balance | $500 (works but with very small position sizing) |
| Recommended balance | $3,000 or higher |
| Leverage | 1:100 or higher |
| Broker | Any retail broker offering XAUUSD plus indices/crypto |
| Chart attachment | Any H1 chart |
| VPS | Recommended for live deployment |
Setup Instructions
- Drop the EA onto any H1 chart.
- Allow algorithmic trading when prompted.
- The EA reports in the Experts log which symbols it has initialized.
- If your broker uses different ticker names than the defaults (for example USTEC instead of NAS100, or DJ30 instead of US30), the EA's automatic resolver will try common variants. If it cannot find a match, edit the *_SymbolName inputs directly to your broker's exact tickers.
- Adjust *_RiskPercent or *_FixedLots per symbol to match your risk tolerance.
- For first-time use, leave all other settings at their defaults and monitor performance for at least one to two weeks before tuning.
The EA writes detailed trade logs to your terminal's Common folder for performance analysis.
Backtesting Recommendations
- Use "Every tick based on real ticks" model for the most accurate results
- Use a broker history that includes all four symbols
- Test minimum 6 months, ideally 12+ months
- Expect different results across different brokers due to spread, swap, and execution differences
- The strategy tester will exercise the configured symbol set; for multi-symbol testing, ensure all four symbols are available in your tester data
Broker Compatibility Notes
If a configured symbol does not exist on your broker (and no variant resolves), the EA silently skips that symbol and trades the remaining ones. You will see this reflected in the Experts log's initialization summary.
If you want to disable trading of a symbol regardless of broker availability, set the corresponding *_Enabled input to false.
Important Disclaimers
- Past performance does not guarantee future results. Backtesting reflects historical behavior under specific market conditions and is not a prediction of live trading outcomes.
- Trading financial instruments carries substantial risk. You can lose more than your initial investment. Only trade with capital you can afford to lose.
- This EA is not a "set and forget" system. Monitor performance regularly and adjust as your account grows or as market conditions change.
- Always test on a demo account first before deploying with real capital, regardless of backtest results.
- Spreads, slippage, and broker execution quality materially affect live results. Live trading will not exactly match the strategy tester.
- No EA can predict market direction with certainty. This EA is a rule-based trading system, not a guaranteed profit system.
Support
Use the MQL5 messaging system or the product comments section for questions about setup, configuration, or broker compatibility. Constructive feedback and bug reports are welcomed.
