Tarea técnica
Smart Money Concepts (SMC) + Break & Retest + Divergence EA
Platform: MetaTrader 5 (MT5) or MetaTrader 4 (MT4) · Automated trading
1. Project objective
I want a fully automated Forex Expert Advisor that identifies high-probability trading setups by combining market structure, break-and-retest strategies, bullish and bearish divergences, swing highs and swing lows, and previous-day high and low levels.
The EA must analyze market conditions, identify potential entry points, calculate stop-loss and take-profit levels, manage risk automatically, and execute trades according to clearly defined rules.
The goal is to prioritize quality setups, favorable risk-to-reward ratios, and consistent risk management rather than entering trades excessively.
2. Core trading strategies
A. Break-and-retest strategy
Identify major support and resistance levels.
Detect a confirmed bullish breakout above resistance or bearish breakdown below support.
Wait for price to return to the broken level.
Confirm the retest with a bullish or bearish rejection candle or other defined price-action confirmation.
Enter only after confirmation, avoiding entries on unconfirmed breakouts.
Allow configurable retest tolerance in pips or as a percentage of ATR.
B. Bullish and bearish divergence
Detect bullish divergence when price forms a lower low while an oscillator forms a higher low.
Detect bearish divergence when price forms a higher high while an oscillator forms a lower high.
Support RSI and MACD as configurable divergence indicators.
Compare confirmed swing points and avoid using unfinished candles for confirmed signals.
Give additional confirmation when divergence occurs near a swing level, previous-day high/low, or a break-and-retest zone.
Optionally detect hidden bullish and hidden bearish divergence.
C. Swing highs and swing lows
The EA must automatically identify and mark significant swing highs and swing lows using a configurable lookback period or a confirmed fractal/pivot method.
Use swing highs and lows to determine market structure.
Identify higher highs, higher lows, lower highs, and lower lows.
Detect breaks of structure (BOS) and changes of character (CHOCH).
Use recent swing points to help determine entries, stop-loss placement, and potential take-profit targets.
Distinguish significant structural swings from minor market noise.
D. Previous-day high and low (PDH/PDL)
The EA must calculate and display the previous trading day's high and low.
Mark PDH and PDL clearly on the chart.
Detect price approaching, rejecting, breaking, or retesting these levels.
Identify potential liquidity sweeps above PDH or below PDL.
Look for bearish confirmation after a sweep above PDH and bullish confirmation after a sweep below PDL.
Allow trades based on these levels only when the configured entry conditions are satisfied.
Use a configurable broker-time or session setting to define the trading day correctly.
3. Trade entry rules
Bullish setup — BUY
Market structure is bullish or price shows a confirmed bullish reversal.
Price breaks resistance or sweeps liquidity below a key low and recovers.
Price retests a relevant structural level, PDH/PDL level, or support zone.
Bullish divergence may provide additional confirmation.
A bullish confirmation candle closes.
The EA calculates the stop-loss, position size, and take-profit before placing the trade.
Bearish setup — SELL
Market structure is bearish or price shows a confirmed bearish reversal.
Price breaks support or sweeps liquidity above a key high and falls back.
Price retests a relevant structural level, PDH/PDL level, or resistance zone.
Bearish divergence may provide additional confirmation.
A bearish confirmation candle closes.
The EA calculates the stop-loss, position size, and take-profit before placing the trade.
Signal filtering: These conditions should be configurable. The EA must not require every optional signal on every trade, but it must enforce the selected minimum confirmation rules.
4. Risk management
Configurable risk per trade, with a default of 1% of account equity.
Automatic lot-size calculation based on stop-loss distance.
Stop-loss beyond a relevant swing high/low or structural invalidation level, with a configurable buffer.
Configurable risk-to-reward ratio, with a default target of 1:2 and an optional 1:3 target.
Optional break-even functionality after a specified profit threshold.
Optional trailing stop based on swing points or ATR.
Maximum daily loss and maximum number of trades per day.
Maximum open trades and configurable limits on simultaneous exposure.
Optional daily profit lock and consecutive-loss protection.
Spread, slippage, and trading-session filters.
No martingale, grid recovery, or uncontrolled lot-size increases.
5. Timeframes and markets
Allow trading on configurable timeframes, such as M5, M15, M30, H1, and H4.
Support multi-timeframe analysis: higher timeframes determine market direction, while lower timeframes identify entries.
Allow selection of Forex pairs and XAUUSD (Gold).
Provide configurable trading sessions and a news filter if a reliable news-data source is available.
Include a setting to disable trading during unsuitable market conditions.
6. EA dashboard and chart features
Display swing highs and lows, BOS and CHOCH levels.
Display previous-day high and low lines.
Mark divergence signals and break-and-retest zones.
Show buy/sell signals, entry price, stop-loss, take-profit, lot size, and risk percentage.
Display current market bias, active trades, daily profit/loss, and risk status.
Include configurable alerts and a trade-history summary.
7. Testing and quality requirements
Deliver clean, compiled EA source code and the compiled file.
Include configurable inputs with descriptions.
Backtest with realistic spreads, commissions, and slippage where supported.
Use out-of-sample testing and walk-forward validation to check robustness.
Report profit factor, maximum drawdown, win rate, number of trades, and average risk-to-reward.
Avoid look-ahead bias, repainting signals, and trades based on information unavailable at the time of entry.
Provide a demo-testing period before live deployment.
Do not promise a guaranteed win rate or profit.
8. Developer deliverables
I want the developer to provide the completed EA, source code, installation instructions, recommended initial settings, and a backtest report. All major strategy and risk-management parameters must be adjustable without modifying the source code.
My recommended starting configuration
Customize these settings, then generate a tailored developer brief.
Trading platform
Markets
Trading style
Entry confirmation
Risk per trade: 1%
Risk-to-reward target
One important recommendation: I would build this as a confluence-based EA, not one that blindly trades every breakout or divergence. For example, a bearish divergence near the previous-day high, followed by a liquidity sweep and a confirmed break-and-retest, can be a stronger setup than any one of those signals in isolation. The developer should make the exact rules testable and configurable rather than assume that combining more indicators automatically improves profitability.