指定

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




ファイル:

応答済み

1
開発者 1
評価
(384)
プロジェクト
495
23%
仲裁
59
56% / 25%
期限切れ
58
12%
仕事中
2
開発者 2
評価
(434)
プロジェクト
638
53%
仲裁
32
59% / 22%
期限切れ
6
1%
仕事中
3
開発者 3
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
4
開発者 4
評価
(107)
プロジェクト
175
25%
仲裁
23
13% / 78%
期限切れ
16
9%
仕事中
5
開発者 5
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
仕事中
パブリッシュした人: 1 code
6
開発者 6
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
7
開発者 7
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
8
開発者 8
評価
(40)
プロジェクト
45
60%
仲裁
2
100% / 0%
期限切れ
1
2%
パブリッシュした人: 5 codes
9
開発者 9
評価
(3)
プロジェクト
5
20%
仲裁
1
100% / 0%
期限切れ
2
40%
10
開発者 10
評価
(1)
プロジェクト
2
0%
仲裁
0
期限切れ
0
11
開発者 11
評価
(12)
プロジェクト
16
25%
仲裁
1
0% / 0%
期限切れ
4
25%
仕事中
12
開発者 12
評価
(1)
プロジェクト
1
0%
仲裁
0
期限切れ
0
類似した注文
I require a custom EA and an accompanying custom indicator built in MQL5 for Meta Trader 4/5. The EA must be fully automated (Algo Trading); Telegram-Signal-Linked and named 'AMK Fx'
Hello, I'm looking for an expert who can help me acquire a secure, easy-to-use bot with Turkish language support for automated buying and selling in Forex, commodities, and cryptocurrencies, and who can also teach me how to set it up and use it
Title Professional AI Automation Trading Bot for Forex & Crypto Solution Language Python (preferred) or MQL5 depending on integration requirements. Categories Expert Advisor (EA) for MetaTrader 5 Automated trading strategies AI/ML-based signal generation Risk management automation Required Skills Strong knowledge of MQL5/Python Experience with MetaTrader API integration Machine learning model deployment
I need an Ai trading bot for Binance and BTC on MT5 that also uses order flow data. It should also make use of TSI- Temporal indicator sampling and also it should make use of fundamental analysis in the process of signal generation

プロジェクト情報

予算
30+ USD
締め切り
最高 10 日

依頼者

出された注文1
裁定取引数0