M1 Gold Hedge
- Experts
- Achmad Benny
- 버전: 2.1
- 업데이트됨: 13 3월 2026
- 활성화: 10
M1 Gold Hedge
A breakout and hedge recovery Expert Advisor designed for Gold (XAUUSD) and major forex pairs. The EA places a two-sided bracket order above and below a recent price range. When one side fills and moves against you, it opens a recovery position in the opposite direction at a larger lot size. All positions are managed as a single basket and close automatically when the profit target is reached.
How It Works
Entry
At the start of each cycle the EA scans the last N bars for a high/low range and places a BuyStop above the high and a SellStop below the low. Only one basket runs at a time. Pending orders that are not filled within the expiry window are cancelled automatically.
Hedge Recovery
When the active position moves against you by the hedge trigger distance, a new position opens in the opposite direction at a larger lot size. This repeats up to the maximum number of hedge levels. At level 6 with default settings the total exposure grows as follows: 0.01 → 0.02 → 0.04 → 0.08 → 0.16 → 0.32 lots.
Basket Exit
- Hard take-profit — closes all positions when combined profit reaches the target dollar amount.
- Trailing take-profit — activates above a configurable threshold and steps back from the peak profit.
- Minimum profit floor — no automated close executes unless the basket profit exceeds this amount, ensuring every exit is in profit.
Two-Layer Protection System
- Freeze mode — when a USD loss or equity drawdown threshold is breached, no new hedge levels are placed. Existing positions remain open. The freeze lifts automatically when the basket recovers to break-even.
- Emergency close — if the account margin level drops below a configurable threshold, all positions are closed immediately to prevent a broker stop-out. This is the only automated close that can execute at a loss.
- Margin check — before every new hedge placement, free margin and equity are verified. The order is blocked if either falls below the safety threshold.
Trend Filter
An optional ADX and Bollinger Band filter on the M5 and M15 timeframes blocks new basket entries when the market is trending. Hedge recovery management continues unaffected when the filter is active.
Session Filter
Trading is restricted to a configurable daily time window. The EA reads the symbol's actual session schedule directly so the filter works correctly in both live trading and the Strategy Tester.
Live Dashboard
A real-time on-chart panel displays balance, equity, free margin, spread, daily P&L, floating profit, total exposure in lots, current hedge level, active take-profit targets, pending order status, and trend filter state.
Key Features
- Works on XAUUSD, EURUSD, and other major symbols
- Compatible with M1, H1, D1 and other timeframes
- Supports both netting and hedging account types
- Broker digit normalisation for 2, 3, 4, and 5 digit brokers
- Magic number isolation — safe to run alongside other EAs
- Auto-restart at midnight for a clean daily cycle
- Fully tested in the MT5 Strategy Tester
Input Parameters
Entry Settings
| Parameter | Default | Description |
|---|---|---|
| InpBarLookback | 5 | Number of bars used to define the breakout high/low range. |
| InpMaxSpread | 50 | Maximum allowed spread in points. No entry is placed if the spread exceeds this value. |
| InpInitialLot | 0.01 | Lot size for the initial breakout order. |
| InpOrderExpireMins | 2 | Cancel unfilled pending breakout orders after this many minutes. Set 0 to disable expiry. |
Hedge / Recovery
| Parameter | Default | Description |
|---|---|---|
| InpLotMultiplier | 2.0 | Multiplier applied to the lot size at each new hedge level. |
| InpMaxLot | 1.0 | Hard cap on the lot size of any single position. |
| InpMaxHedgeLevels | 6 | Maximum number of hedge recovery levels allowed. Set 0 for unlimited (not recommended). |
| InpHedgeDistance | 500 | Distance in points the price must move against the newest position to trigger the next hedge level. |
Profit Target
| Parameter | Default | Description |
|---|---|---|
| InpTargetProfit | 5.00 | Close all positions when basket profit reaches this amount in account currency. |
| InpTrailStart | 3.00 | Activate the trailing exit when basket profit reaches this amount. |
| InpTrailStep | 1.00 | Close the basket when profit pulls back this amount from the trailing peak. |
| InpMinCloseProfit | 0.10 | Minimum basket profit required for any automated close to execute. Guarantees every exit is in profit. |
Loss Freeze Levels
| Parameter | Default | Description |
|---|---|---|
| InpFreezeLossUSD | 30.0 | Freeze new hedge placements when basket loss reaches this amount. Set 0 to disable. |
| InpFreezeDrawPct | 10.0 | Freeze new hedge placements when equity drops this percentage below the balance at basket open. Set 0 to disable. |
| InpEmergencyMarginPct | 100.0 | Close all positions immediately if the account margin level falls below this percentage. Prevents broker stop-out. Set 0 to disable (not recommended for live trading). |
Trend Filter
| Parameter | Default | Description |
|---|---|---|
| InpUseTrendFilter | true | Enable or disable the trend filter entirely. |
| InpFilterM5 | true | Include the M5 timeframe in the trend check. |
| InpFilterM15 | true | Include the M15 timeframe in the trend check. |
| InpADXPeriod | 14 | Period for the ADX indicator used in the trend filter. |
| InpADXThreshold | 25.0 | ADX value above which the market is considered trending and new entries are blocked. |
| InpBBPeriod | 20 | Period for the Bollinger Bands indicator used in the trend filter. |
| InpBBDeviation | 2.0 | Standard deviation multiplier for Bollinger Bands. |
| InpADXRequired | true | Require ADX to confirm a trend. When both InpADXRequired and InpBBRequired are true, both indicators must agree (AND mode). |
| InpBBRequired | true | Require a Bollinger Band breakout to confirm a trend. Set either to false for OR mode. |
Time Filter
| Parameter | Default | Description |
|---|---|---|
| InpStart | h02 | Hour of day when trading is allowed to begin (broker server time). |
| InpEnd | h22 | Hour of day when trading stops for the session. |
| InpAutoRestart | true | Automatically reset state variables at midnight for a fresh daily cycle. |
System
| Parameter | Default | Description |
|---|---|---|
| InpMagic | 586677 | Magic number used to identify orders and positions belonging to this EA. |
| InpAlerts | true | Enable popup alerts for key events such as take-profit hit, freeze activated, and emergency close. |
Dashboard
| Parameter | Default | Description |
|---|---|---|
| InpDashX | 20 | Horizontal position of the dashboard panel in pixels from the left edge of the chart. |
| InpDashY | 20 | Vertical position of the dashboard panel in pixels from the top edge of the chart. |
Risk Warning
This EA uses a martingale-style recovery system. Lot sizes increase with each hedge level and total exposure grows significantly in adverse market conditions. Always test thoroughly on a demo account before live trading. Ensure the freeze levels and emergency close threshold are configured appropriately for your account size. Past performance in the Strategy Tester does not guarantee future results.
Note:
- Always test on a demo account first to understand how the breakout levels and trailing stop behave during different market sessions.
- Use a Cent account if you don't have a lot of funds.
- Contact Person https://t.me/eadevgold
-
Let's discuss and develop together by joining our community at https://t.me/m1goldscalper
Hedging strategy requires a large amount of capital to withstand floating.

