Specification

# H4 Zone Retest EA (MQL5)

An automated trading Expert Advisor (EA) for MetaTrader 5, developed in MQL5.  
The EA trades gold (XAUUSD) using a multi-timeframe breakout and retest strategy: it defines the first H4 candle of each day as a trading zone, detects breakouts on the M5 chart, waits for a retest, and executes trades with risk management, trailing stops, and optional news filtering.

---

## Features

- H4 → M5 breakout and retest trading logic  
- Configurable fixed lot or risk-based position sizing  
- Trailing stop management  
- **Smart news filter** that avoids trading around high-impact events  
- Spread and terminal safety checks  
- Dynamic lot calculation based on risk percentage  

## Strategy Overview

1. **Zone identification (H4)**  
   The EA marks the first H4 candle of the current day and stores its high and low as the trading zone boundaries.

2. **Breakout detection (M5)**  
   On each new M5 candle:  
   - A bullish breakout occurs when the candle closes above `zoneHigh`.  
   - A bearish breakout occurs when the candle closes below `zoneLow`.  
   When a breakout occurs, the EA starts waiting for a retest.

3. **Retest entry**  
   - If price returns to the broken zone within a specified window (`MaxWaitSeconds`):  
     - **Buy** on bullish retest → SL = breakout candle low, TP = 1.5 × risk distance.  
     - **Sell** on bearish retest → SL = breakout candle high, TP = 1.5 × risk distance.  
   - Uses either a fixed lot (`Lots`) or a risk-based lot (`UseRiskPercent`, `RiskPercent`).

4. **Trade management and protection**  
   - Trailing stop control (`UseTrailingStop`, `TrailingStart`, `TrailingStep`).  
   - Spread and trade-permission checks (`MaxSpreadPoints`, `TERMINAL_TRADE_ALLOWED`).  
   - **Built-in news filter**: the EA checks the MetaTrader 5 economic calendar (`CalendarValueHistory`) and automatically avoids opening new trades within the defined window around **high-impact news events** for a selected currency (`NewsFilterCurrency`, `NewsFilterMinutes`).  
   - This filter helps prevent entries during volatile periods and improves stability during major market announcements.


## Input Parameters

| Parameter | Description | Default |
|------------|-------------|----------|
| `Lots` | Fixed lot size per trade | 0.01 |
| `UseRiskPercent` | Enable dynamic lot sizing by risk | false |
| `RiskPercent` | Percent of balance risked per trade | 1.0 |
| `MaxWaitSeconds` | Maximum time allowed for retest | 86400 |
| `UseTrailingStop` | Enable trailing stop | true |
| `TrailingStart` | Profit (points) before trailing begins | 200 |
| `TrailingStep` | Distance (points) of trailing stop | 100 |
| `UseNewsFilter` | Enable high-impact news filter | true |
| `NewsFilterMinutes` | Minutes before/after news to avoid trading | 30 |
| `MagicNumber` | Unique identifier for EA positions | 202503 |

---

## Requirements

- MetaTrader 5 platform  
- Broker supporting XAUUSD (gold) trading  
- MQL5 environment (MetaEditor)  
- Historical data for backtesting  

---

## Installation

1. Open **MetaEditor** → *File → Open Data Folder*  
2. Copy the `.mq5` file into `MQL5/Experts/`  
3. Compile the EA  
4. In MetaTrader 5, open *Navigator → Expert Advisors*  
5. Attach the EA to a **XAUUSD** chart  
6. Adjust input parameters as needed  

---
## Backtest
**Symbol:** XAUUSD  
**Timeframe:** M5  
**Period:** Jan 2024 – Apr 2026  
**Model:** Every tick (MetaTrader 5 Strategy Tester)





### Notes
- Default parameters were used unless otherwise stated.  
- The test includes realistic spreads and commissions.  
- Results are for research and educational purposes only and do not guarantee future performance.




Files:

Responded

1
Developer 1
Rating
(401)
Projects
519
24%
Arbitration
61
57% / 25%
Overdue
60
12%
Working
2
Developer 2
Rating
(436)
Projects
647
53%
Arbitration
35
63% / 20%
Overdue
7
1%
Working
3
Developer 3
Rating
Projects
1
0%
Arbitration
0
Overdue
1
100%
Free
4
Developer 4
Rating
(111)
Projects
183
25%
Arbitration
25
16% / 76%
Overdue
16
9%
Working
5
Developer 5
Rating
(10)
Projects
12
33%
Arbitration
0
Overdue
2
17%
Working
Published: 1 code
6
Developer 6
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
7
Developer 7
Rating
(11)
Projects
16
38%
Arbitration
0
Overdue
1
6%
Loaded
8
Developer 8
Rating
(45)
Projects
53
57%
Arbitration
2
100% / 0%
Overdue
1
2%
Free
Published: 5 codes
9
Developer 9
Rating
(6)
Projects
8
38%
Arbitration
2
50% / 50%
Overdue
2
25%
Free
10
Developer 10
Rating
(3)
Projects
4
0%
Arbitration
0
Overdue
0
Free
11
Developer 11
Rating
(16)
Projects
21
29%
Arbitration
2
50% / 0%
Overdue
4
19%
Working
12
Developer 12
Rating
(4)
Projects
4
25%
Arbitration
0
Overdue
0
Free
13
Developer 13
Rating
(25)
Projects
33
18%
Arbitration
6
50% / 33%
Overdue
4
12%
Free
14
Developer 14
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
15
Developer 15
Rating
(9)
Projects
10
10%
Arbitration
0
Overdue
0
Free
16
Developer 16
Rating
(8)
Projects
8
0%
Arbitration
2
50% / 0%
Overdue
1
13%
Working
17
Developer 17
Rating
(298)
Projects
478
40%
Arbitration
105
40% / 24%
Overdue
82
17%
Loaded
Published: 2 codes
18
Developer 18
Rating
(14)
Projects
21
24%
Arbitration
0
Overdue
2
10%
Free
Published: 3 codes
19
Developer 19
Rating
(10)
Projects
14
43%
Arbitration
0
Overdue
3
21%
Free
20
Developer 20
Rating
(263)
Projects
309
76%
Arbitration
14
71% / 0%
Overdue
6
2%
Loaded
21
Developer 21
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
22
Developer 22
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
23
Developer 23
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
24
Developer 24
Rating
(1)
Projects
0
0%
Arbitration
1
0% / 100%
Overdue
0
Free
25
Developer 25
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
26
Developer 26
Rating
(49)
Projects
74
18%
Arbitration
30
17% / 53%
Overdue
31
42%
Free
27
Developer 27
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
28
Developer 28
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
29
Developer 29
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
30
Developer 30
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
31
Developer 31
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
32
Developer 32
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
33
Developer 33
Rating
Projects
1
0%
Arbitration
0
Overdue
0
Free
Published: 11 codes
34
Developer 34
Rating
(1)
Projects
1
0%
Arbitration
0
Overdue
0
Free
Published: 2 codes
35
Developer 35
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
36
Developer 36
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
Similar orders
can you help me use a Tickblaze Algo NRBO on the NT platform? I have it somewhat set up, but I have other questions about running it & knowing how to operate it in NT. Thank you if anyone have experience in this kindly bib and let do it asap
I need a fully automated custom Expert Advisor for MetaTrader 5 (MQL5). The EA is intended for use on a The5ers $100,000 2-Step prop-firm account. IMPORTANT DELIVERY REQUIREMENT: I must receive the complete editable .mq5 source code as well as the compiled .ex5 file. Compiled-only delivery is NOT acceptable. The EA must be coded specifically for this project and must not copy trades, use external trading signals or
Le robot devra : Respecter strictement les règles de risque des comptes FTMO : perte journalière maximale, perte maximale totale, taille des positions, etc. Intégrer un système de gestion du risque automatique. Être capable de gérer différents types de comptes et tailles de capital. Être basé sur ma stratégie et mes règles de trading que je fournirai au développeur. Être entièrement automatisé pour l’exécution des
I need a trading system similar to the attached files. Check attachment for details on the indicator. i guess the indicator contains some of (Rainbow MA , MTF Dashboard , Symbol Switcher , and Trend Histogram), though may not be exactly as listed
VENOM EA 35 - 50 USD
So, im a beginner and I'm pleading you to built me a bot that runs 24hrs and that can buy and sell at the same time, choose a better and profitable strategy. I will do anything thing it takes to get the bot. I hope you take my request into consideration
Je cherche un développeur MQL4 / MQL5 expérimenté pour créer un robot de trading automatique (Expert Advisor) performant et sécurisé. Validation de comptes Prop Firm capable de trader sur le forex et les matière première
THE PIP CRUSHER 61+ USD
**PROJECT TITLE:** MQL5 Expert Advisor — Debug, Fix & Finalize (THE PIP CRUSHER) --- **PROJECT TYPE:** Fix and finalize existing MQL5 Expert Advisor code. This is NOT a strategy development job. The strategy is fully designed and the code is already written. I need a skilled MQL5 developer to compile the code, fix all errors and warnings, verify the logic works correctly, and deliver a clean working EA. --- **ABOUT
I need a simple Expert Advisor for MT5 that trades based on RSI overbought/oversold levels. - Entry: Buy when RSI(14) < 30, Sell when RSI(14) > 70 - Exit: Take Profit and Stop Loss as adjustable input parameters (default 50/25 pips) - Position sizing: Risk 1% of account balance per trade, auto-calculated from stop-loss distance - Timeframe and currency pair: adjustable inputs, not hardcoded - Should include basic
1. Trading Instruments: - The robot should trade exclusively on the following currency pairs: - NZD/CHF - NZD/USD - GBP/USD 2. Trading Style: - The robot should implement a day trading strategy, focusing on short-term trades. 3. Risk Management: - Maximum drawdown percentage: 10%. - Stop loss settings: Adjustable based on volatility (suggested default: 30 pips). - Take profit settings: Adjustable
I have an existing working MQL5 Expert Advisor and require an experienced MQL5 programmer/trading-system analyst to independently analyse its historical performance. This is NOT initially a request to rewrite the EA or simply optimize parameters. Current strategy: - MetaTrader 5 - M15 timeframe - EMA / ADX / ATR based - Approximately 1,337 historical trades - Gross Profit approximately USD 271,000 - Gross Loss

Project information

Budget
30+ USD
Deadline
to 10 day(s)