MT5 EA (Hedging) — XC + WAD + Keltner 3-Leg System with Strong/Weak Entries + Re-entry Lockout + Visual Indicators + Retracement Entry Option

MQL5 Indicators Experts

Specification

Overview

I need an MT5 Expert Advisor (MQL5) for a mechanical trading system.
It is a hedging account and must run as a true 3-position (3-leg) system (3 separate positions), not partial closes.

The EA must match my rules exactly and behave consistently in Strategy Tester and live charts (bar-close signal logic, no forward-looking).

Timeframe / Execution

  • Signal timeframe: input
  • All signals are evaluated on the last closed candle (bar1).
  • Strong signals execute at the open of the new candle (market order at bar0 open).
  • Weak signals are 1-candle expiry stop orders (virtual is fine, but must replicate stop behavior).

Indicators (EA must calculate internally from OHLC)

1) XC (Expansion/Contraction)

EA must compute:

  • XC Short+ (PositiveShort)
  • XC Short- (NegativeShort)
  • XC Long+ (PositiveLong)
  • XC Long- (NegativeLong)

2) WAD (Williams Accumulation/Distribution), WAD SMA

3) Keltner Channel (TradingView style)

Must match TradingView settings:

Entry Rules (Signals on bar t = bar1)

Strong Buy

Weak Buy (1-bar expiry STOP)

Strong Sell

Weak Sell (1-bar expiry STOP)

Reversal Handling (Important)

If there is an opposite direction trigger, the EA must:

  1. Close all current legs immediately at market
  2. Then open the opposite direction trade
    Weak reversal only happens if the weak stop actually triggers.

Also handle edge case:

  • If a weak stop from day t triggers on day t+1 AND day t+1 is also a strong signal day, the weak stop fill price takes priority (stop filled intrabar), not the strong close/open price.

3-Leg Trade Management

When trade opens, open 3 separate positions with same SL but different exits.

Define risk unit:

  • R = KC(20,1) width = KC_upper(20,1) - KC_lower(20,1) on signal candle (bar1)

Stop Loss:

  • Long SL = entry - R
  • Short SL = entry + R

Leg exits:

  • Leg 1 TP1 = entry ± 1R
  • Leg 2 TP2 selectable by input:
    • Mode A: 2R
    • Mode B: KC(20,3) value from previous candle (bar1):
      • Long TP2 = KC upper(20,3)[bar1]
      • Short TP2 = KC lower(20,3)[bar1]
  • Leg 3 TP3 trailing:
    • TP3 activates once price reaches 3R.
    • After 3R, trail by 25% retracement from best extreme since TP3 activation (keep 75% profit):
      • For long: keep level = entry + 0.75*(highestHighSince3R - entry)
      • For short: keep level = entry - 0.75*(entry - lowestLowSince3R)
    • Stop should only tighten, never loosen.

Optional input:

  • MOVE_BE_AFTER_TP1 (default true): after TP1 hits, move SL of legs 2 & 3 to breakeven.

Re-entry Lockout Logic (Very Important)

When flat, re-entry is restricted depending on how last trade closed:

If last trade did NOT hit TP3

Use XC Long series lockout:

  • After a LONG trade: must see XC Long- > XC Long+ (bear phase) and then later XC Long+ > XC Long- (bull phase) before allowing new LONG trades. Until then, only SHORT setups are allowed.
  • After a SHORT trade: must see XC Long+ > XC Long- then later XC Long- > XC Long+ before allowing new SHORT trades. Until then, only LONG setups are allowed.

If last trade DID hit TP3

Use XC Short series lockout instead (same two-step flip logic).

This must be coded as a small state machine (phase0 → phase1 → unlock).

Risk Sizing

Inputs:

  • Capital M (e.g. 100000)
  • Risk percent N (e.g. 1%)
  • EA risks N% of M per trade, then splits into 3 legs automatically.

Must respect symbol min lot / step / max.

Visual Requirements (Strategy Tester)

When EA attached in Strategy Tester Visual mode:

  • Apply chart template-like settings:
    • White background, black foreground
    • Bull candles white, bear candles black
    • Bar up/down black
    • Grid OFF
  • Add indicators automatically (or embed indicator plots inside EA):
    • XC with:
      • Short+ green line, Short- red line
      • Long area fill: green when Long+>Long-, red when Long->Long+
    • WAD with:
      • WAD green when WAD>WAD_SMA, red when WAD<WAD_SMA
      • WAD_SMA black

    NEW ENTRY METHOD OPTION: “Retracement Entry” (Trail-from-trigger, not fixed % of R)

    Add an optional entry mode that replaces immediate entry with a retracement limit order.

    Inputs

    • USE_RETRACEMENT_ENTRY (bool)
    • RETRACE_PCT (double, e.g. 0.50 for 50%)

    When retracement is enabled

    A “trigger event” still occurs (Strong signal or Weak trigger). On trigger:

    1. If holding opposite direction positions, close ALL 3 legs immediately at market.
    2. Do NOT enter immediately. Instead, start tracking the move from the trigger and place a retracement limit order derived from the post-trigger extreme.

    What counts as a “trigger event”

    • Strong Buy/Sell trigger: conditions met on bar1 close (normal strong signal timing).
    • Weak Buy/Sell trigger: only when the 1-bar expiry stop is actually hit intrabar (weak setups that don’t trigger do nothing).

    How retracement price is computed (trail-from-trigger extreme)

    Define:

    • TriggerPrice = the normal entry reference for that signal
      • Strong: Close(bar1) (or the system’s strong reference price)
      • Weak: the weak stop trigger price (e.g., 1.0015*Close(bar1) or 0.9985*Close(bar1))

    After the trigger event, track the best extreme since trigger:

    For LONG retracement

    • Track ExtremeHigh = highest high since trigger
    • Compute candidate retrace price:
      • Q = ExtremeHigh - RETRACE_PCT * (ExtremeHigh - TriggerPrice)
    • If Q > TriggerPrice, then queue at TriggerPrice instead (cap it):
      • Q = TriggerPrice
    • Place BUY LIMIT at Q

    For SHORT retracement

    • Track ExtremeLow = lowest low since trigger
    • Compute candidate retrace price:
      • Q = ExtremeLow + RETRACE_PCT * (TriggerPrice - ExtremeLow)
    • If Q < TriggerPrice, then queue at TriggerPrice instead:
      • Q = TriggerPrice
    • Place SELL LIMIT at Q

    One critical cancellation rule

    If price reaches TP1 level (defined by the system) before the retracement limit order is filled, then:

    • Cancel the limit order
    • Treat the setup as “missed” (no position opens)

    Exits stay based on the trigger reference (NOT the fill price)

    Even though the fill may be better/worse, the SL/TP levels remain exactly as if we entered at TriggerPrice:

    • R = KC(20,1)[bar1] width
    • SL = TriggerPrice ± 1R
    • TP1 = TriggerPrice ± 1R
    • TP2 = TriggerPrice ± 2R OR KC(20,3)[prev] depending on mode
    • TP3 activates at TriggerPrice ± 3R and trails per TP3 rules

    Very important: lockout/re-entry logic must run on “trigger”, even if no fill happens

    The system’s Re-entry Lockout Logic must continue running as if a trade “event” happened, even if the retracement limit never gets filled.

    So the EA must record the trigger direction and trigger time and use it to update lockout state exactly as if the trade was taken.

    Re-entry Lockout Logic (must remain intact):

    If last trade/trigger did NOT hit TP3

    • Use XC Long series lockout
      • After a LONG: require XC Long- > XC Long+ then later XC Long+ > XC Long- before allowing LONG again
      • After a SHORT: require XC Long+ > XC Long- then later XC Long- > XC Long+ before allowing SHORT again

    If last trade/trigger DID hit TP3

    • Use XC Short series lockout instead (same two-step flip logic)

    Additional edge cases the EA must handle

    • If an opposite trigger occurs while a retracement limit is pending:
      • Cancel the pending limit
      • Apply the opposite trigger rules (including close-all if needed)
      • Then start a new retracement tracking/limit for the new trigger


    Deliverables

    1. .mq5 EA source (clean, commented, no obfuscation)
    2. If needed: XC and WAD indicator source or integrated indicator plotting inside EA
    3. Must compile with 0 errors on latest MT5
    4. Instructions on where to place files and how to test

    Testing

    I will validate by:

    • Running Strategy Tester on the same symbol/timeframe and comparing trades to my Python backtest logic.

    I can provide:

    • Example trades / reference logs
    • The XC indicator source code (already have it)
    • Expected behavior in tricky cases (weak+strong same day, reversal same day, etc.)



    Responded

    1
    Developer 1
    Rating
    (15)
    Projects
    34
    24%
    Arbitration
    4
    0% / 50%
    Overdue
    2
    6%
    Working
    2
    Developer 2
    Rating
    (3)
    Projects
    3
    0%
    Arbitration
    2
    0% / 50%
    Overdue
    1
    33%
    Loaded
    3
    Developer 3
    Rating
    (21)
    Projects
    30
    57%
    Arbitration
    0
    Overdue
    1
    3%
    Working
    4
    Developer 4
    Rating
    Projects
    0
    0%
    Arbitration
    0
    Overdue
    0
    Free
    5
    Developer 5
    Rating
    (265)
    Projects
    596
    35%
    Arbitration
    64
    20% / 58%
    Overdue
    147
    25%
    Free
    Published: 1 article, 22 codes
    6
    Developer 6
    Rating
    Projects
    0
    0%
    Arbitration
    0
    Overdue
    0
    Free
    7
    Developer 7
    Rating
    (2)
    Projects
    2
    0%
    Arbitration
    1
    0% / 0%
    Overdue
    1
    50%
    Working
    8
    Developer 8
    Rating
    (8)
    Projects
    11
    9%
    Arbitration
    3
    33% / 33%
    Overdue
    4
    36%
    Loaded
    9
    Developer 9
    Rating
    (306)
    Projects
    549
    35%
    Arbitration
    79
    32% / 42%
    Overdue
    197
    36%
    Loaded
    10
    Developer 10
    Rating
    (144)
    Projects
    186
    41%
    Arbitration
    24
    58% / 21%
    Overdue
    13
    7%
    Free
    11
    Developer 11
    Rating
    (494)
    Projects
    958
    74%
    Arbitration
    27
    19% / 67%
    Overdue
    100
    10%
    Busy
    Published: 1 article, 6 codes
    12
    Developer 12
    Rating
    Projects
    0
    0%
    Arbitration
    0
    Overdue
    0
    Free
    13
    Developer 13
    Rating
    (6)
    Projects
    8
    0%
    Arbitration
    8
    13% / 88%
    Overdue
    0
    Free
    14
    Developer 14
    Rating
    (77)
    Projects
    241
    73%
    Arbitration
    7
    100% / 0%
    Overdue
    1
    0%
    Free
    15
    Developer 15
    Rating
    Projects
    0
    0%
    Arbitration
    1
    0% / 100%
    Overdue
    0
    Free
    Similar orders
    I'm looking for someone who can create a EA for an existing MT5 indicator. The goal is to have the EA execute orders when the indicator gives a signal. I already have the SC to the indicator. I would prefer an EA that can be added to the existing Indicator. Message me for more details
    I need a professional developer to build a Telegram-to-MetaTrader trade copier system. Project overview: - A Telegram bot will read trade signals from a Telegram channel - Trades will be automatically executed on MT4 and/or MT5 accounts - The system must support copying trades to multiple MetaTrader accounts - Execution should work even when the user is offline Functional requirements: - Structured signal format
    Robot mt5 30 - 120 USD
    Urgent! I need a bot like the one in the video for the MT5 platform, working the same way on a real account. Please watch the video as soon as possible
    I need a MetaTrader 5 Expert Advisor (EA) built based on a clear, rule-based strategy for XAUUSD on the M5 timeframe. Indicators used: EMA 50 (Exponential, Close) EMA 200 (Exponential, Close) RSI (14) Stochastic Oscillator (14,3,3) BUY rules: Price above EMA 50 and EMA 200 RSI between 10 and 25 Stochastic crosses upward from below 20 Bullish candle close SELL rules: Price below EMA 50 and EMA 200 RSI between 80 and
    IF no open trades AND trading session is London or New York THEN IF price > EMA50 AND price > EMA200 SET trade_direction = BUY ELSE IF price < EMA50 AND price < EMA200 SET trade_direction = SELL ELSE EXIT (do nothing) IF trade_direction = BUY AND RSI >= 10 AND RSI <= 25 AND Stochastic_K crosses above Stochastic_D AND candle closes bullish THEN Open BUY trade Set Stop Loss Set Take
    Nhân bản vô tính 30 - 70 USD
    Tôi có 1 mt4 được chia sẻ, bạn có ai giúp tôi sao chép chiến lược của mỗi cái này không? Đặc biệt: _ phù hợp tài khoản vốn nhỏ _ vào nhiều lệnh _ không có tính năng né tin nhưng dù có tin ra thì vẫn giao dịch an toàn. I have an MT4 trading platform that was shared with me. Can anyone help me copy the trading strategies for each of these platforms? Specifically: _ Suitable for small capital accounts _ Allows for
    Platform: MT5 | Instrument: XAUUSD | Broker: IC Markets (ECN) Style: High-speed scalping / short-term momentum | Timeframes: M1 & M5 | Operation: Fully automated, 24/5 Overview We seek an experienced MQL5 developer to build a fast, reliable EA for live trading. The EA must: Detect symbol specifications automatically (digits, tick size, contract size) Operate continuously without manual intervention Follow logical
    I want recovery zone system to attach with any other ea on chart to manage per trade by zone recovery strategy with management of sl tp to cover in profits or neutral
    Monthly >Previous month High and Low.High is Resistance and Low is Support level Daily > Demand and supply zones. Demand Below Support Level and Supply Above Resistance Level. 4HOUR >Up-Tren,Down-Trend and Cosolodation >Market Structure CHOCH,BOS >3 phase movement HH,HL and LL,LH. Entry
    Our EA was martiangle on EURUSD that double lot size in every 20 pips we want to change parameters for what to do in trending market so we want devloper who can help us to modify the and guide us what parameters we can change in trending market

    Project information

    Budget
    50 - 200 USD

    Customer

    (1)
    Placed orders2
    Arbitrage count0