Техническое задание
I need an MT5 Expert Advisor based on a TradingView indicator.
The EA must replicate the indicator signals and include hedging, martingale recovery, and risk management features.
The EA is for XAUUSD (Gold) trading on MT5 (hedging account).
Requirements1. Indicator & Entry Rules
-
EA must display the indicator on the MT5 chart.
-
Entry signals:
-
Buy: when price touches LS1, LS2, or LS3 (each can be enabled/disabled).
-
Sell: when price touches SS1, SS2, or SS3 (each can be enabled/disabled).
-
-
TP and SL:
-
Can be fixed or ATR-based.
-
Use real TP but virtual SL (hidden from broker).
-
2. Hedging & Recovery Logic
-
If a trade hits SL:
-
Close it immediately.
-
Open a hedge trade in the opposite direction.
-
-
If hedge trade also hits SL:
-
Close it.
-
Open the next hedge trade.
-
-
Only one hedge trade at a time → when a new hedge trade opens, the old one must be closed.
-
All hedge trades use the same TP/SL as the first trade.
-
Continue until TP is hit or maximum hedge trades is reached.
3. Lot Sizing Rules
-
For fixed TP/SL: hedge multiplier is manually adjustable.
-
For ATR-based TP/SL: lot size auto-adjusts relative to SL distance.
-
Example: If SL = 50 pips → first hedge lot = 5× initial lot, next hedge = 5× previous, etc.
-
4. Trade Management
-
Do not open multiple trades in the same zone at the same time.
-
Allow multiple zones:
-
Example: If Sell–Buy–Sell zones appear → EA opens 1 trade per zone.
-
-
Maximum trades per band (adjustable).
-
Example: Limit 2 trades in Red Band. Reset when band color changes.
-
5. X-Lot Mode (No Hedge Mode)
-
When hedging is disabled, activate X-Lot mode.
-
Only 1 trade open at a time.
-
If trade hits SL → next trade lot = multiplier × previous.
-
Goal: recover loss once TP is hit.
6. Manual Trade Management
-
Option to manage manual trades (filtered by magic number).
-
When enabled, EA auto-mode is disabled.
-
Manual trades can still use hedge mode or X-Lot mode.
7. Additional Features
-
Trading session filter (set hours).
-
Daily maximum profit target (auto-stop).
-
Daily maximum loss limit (auto-stop).
-
Alerts for trade open/close (screen, email, push).
-
Inputs: lot size, TP, SL, hedge multiplier, max hedge trades, daily profit/loss limits, session hours, magic number, comment.
-
Source code (.mq5) + compiled file (.ex5).
-
No DLLs or external libraries.
-
Fully tested on XAUUSD (Gold), MT5, hedging account.