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

MQL5 Indicateurs Experts

Spécifications

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.)



    Répondu

    1
    Développeur 1
    Évaluation
    (15)
    Projets
    34
    24%
    Arbitrage
    4
    0% / 50%
    En retard
    2
    6%
    Travail
    2
    Développeur 2
    Évaluation
    (3)
    Projets
    3
    0%
    Arbitrage
    2
    0% / 50%
    En retard
    1
    33%
    Chargé
    3
    Développeur 3
    Évaluation
    (21)
    Projets
    30
    57%
    Arbitrage
    0
    En retard
    1
    3%
    Travail
    4
    Développeur 4
    Évaluation
    Projets
    0
    0%
    Arbitrage
    0
    En retard
    0
    Gratuit
    5
    Développeur 5
    Évaluation
    (265)
    Projets
    596
    35%
    Arbitrage
    64
    20% / 58%
    En retard
    147
    25%
    Gratuit
    Publié : 1 article, 22 codes
    6
    Développeur 6
    Évaluation
    Projets
    0
    0%
    Arbitrage
    0
    En retard
    0
    Gratuit
    7
    Développeur 7
    Évaluation
    (2)
    Projets
    2
    0%
    Arbitrage
    1
    0% / 0%
    En retard
    1
    50%
    Travail
    8
    Développeur 8
    Évaluation
    (8)
    Projets
    11
    9%
    Arbitrage
    3
    33% / 33%
    En retard
    4
    36%
    Chargé
    9
    Développeur 9
    Évaluation
    (306)
    Projets
    549
    35%
    Arbitrage
    79
    32% / 42%
    En retard
    197
    36%
    Chargé
    10
    Développeur 10
    Évaluation
    (144)
    Projets
    186
    41%
    Arbitrage
    24
    58% / 21%
    En retard
    13
    7%
    Gratuit
    11
    Développeur 11
    Évaluation
    (494)
    Projets
    958
    74%
    Arbitrage
    27
    19% / 67%
    En retard
    100
    10%
    Occupé
    Publié : 1 article, 6 codes
    12
    Développeur 12
    Évaluation
    Projets
    0
    0%
    Arbitrage
    0
    En retard
    0
    Gratuit
    13
    Développeur 13
    Évaluation
    (6)
    Projets
    8
    0%
    Arbitrage
    8
    13% / 88%
    En retard
    0
    Gratuit
    14
    Développeur 14
    Évaluation
    (77)
    Projets
    241
    73%
    Arbitrage
    7
    100% / 0%
    En retard
    1
    0%
    Gratuit
    15
    Développeur 15
    Évaluation
    Projets
    0
    0%
    Arbitrage
    1
    0% / 100%
    En retard
    0
    Gratuit
    16
    Développeur 16
    Évaluation
    (4)
    Projets
    7
    0%
    Arbitrage
    3
    33% / 33%
    En retard
    3
    43%
    Chargé
    Commandes similaires
    //+------------------------------------------------------------------+ //| XAUUSD Ultimate Institutional EA | //| Features: | //| - True swing-based market structure | //| - BOS sniper entries on M5 | //| - Liquidity sweep filter | //| - Partial TP + breakeven | //| - Visual BOS, swings, liquidity
    MetalFlow EA 70+ USD
    I need a MetaTrader 5 Expert Advisor built to trade metals only: XAUUSD, XAGUSD, XPDUSD, and XPTUSD. The EA should be trend-based using moving averages and RSI, enter on pullbacks, allow only one trade per symbol, and use strict risk management with volatility-based stop loss and 2:1 reward-to-risk. It should trade only during active market hours, include spread filtering, auto lot sizing, and be lightweight and
    strategy is as follows market gold, timeframe 1 hour. for buys once a candlestick closes 10 pips or lower away from candlestick high. for sells once a candlestick closes 10 pips or lower away from candlestick low, the stop loss is 100 pips and he take profit is two things one 500 pips or for buys once candlestick closes 10 pips or lower away from low of candle stick, and sells once candlestick closes 10 pips or lower
    New EA Urgent! 30+ USD
    greetings,i am currently looking for a good programmer to help me develop a custom ea using a custom indicator,the strategy will be based on currency correlation,the ea should also have a break even stop loss...thank you
    Hi There, I have an indicator which i am using to take trades manually and looking to automate trades through EA. Reach out to discuss further on this work. Cheers
    We are looking to acquire an existing, profitable EA that trades using price action–based logic . The EA must operate as a day-trading system with proper Stop Loss and Take Profit , and must NOT use grid, martingale, or high-frequency scalping . This is a buyout request — we want to purchase the complete strategy along with the full source code . We are not looking to develop a new EA from scratch
    Build a low-latency, event-driven trading bot for Polymarket esports markets that ingests real-time PandaScore LoL match events , converts them into dynamic win-probability estimates , detects micro-latency mispricing opportunities , and executes short-hold automated trades , with an architecture designed to scale later to Dota 2 and CS2
    Hola, Necesito un EA o sistema que me permita copiar operaciones de una cuenta de origen (demo, inversor o real) a una cuenta real , con ciertas reglas específicas que detallo a continuación: Requisitos Tipo de órdenes: La cuenta de origen puede abrir operaciones como Buy Stop o Sell Stop , pero en la cuenta real quiero que se abran órdenes de mercado al instante , tan pronto la operación se activa en la cuenta de
    I will develop a custom MetaTrader 5 Expert Advisor based on the client’s provided trading rules. The EA will include proper entry and exit logic, stop loss and take profit handling and stable risk management. The code will be clean, non-repainting, MT5 compliant, and delivered with full source files. "Risk Disclosure : Trading in financial markets involves risk, and results depend on market conditions, broker
    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

    Informations sur le projet

    Budget
    50 - 200 USD

    Client

    (1)
    Commandes passées2
    Nombre d'arbitrages0