Golden Ratio Hunter
- Эксперты
-
Alex Amuyunzu Raymond
I’m an experienced MQL5 developer and software engineer specializing in building robust, high-performance algorithmic trading systems for MetaTrader 5. My work goes beyond standard EA development — I design intelligent, scalable solutions that combine market logic, automation, and external - Версия: 1.10
- Активации: 5
Golden Ratio Hunter: Trade the Geometry the Market Keeps Repeating
Markets breathe in proportions. Every major swing retraces and extends in ratios traders have measured for decades, and the ABCD harmonic pattern is where those ratios line up most cleanly. Golden Ratio Hunter is an Expert Advisor built to find that pattern on your chart, filter it against the dominant trend, and trade it with disciplined risk, broker-aware order handling and a structured recovery plan.
What it does
Golden Ratio Hunter scans the last 300 bars of the chart it is attached to, maps every confirmed swing high and swing low, and looks for a valid A-B-C-D sequence. When a pattern passes the ratio test, the EA checks that the trend agrees, checks that market conditions are acceptable, and only then opens a trade. Everything is evaluated once per new bar, so behaviour is stable and does not repaint.
Pattern engine
- Swing points are confirmed with configurable left and right pivot bars (default 3 and 3), so a swing only counts once price has proven it.
- The B-to-C retracement must fall between 38.2% and 88.6% of the A-to-B leg, with an adjustable tolerance (default 12%).
- The C-to-D extension must fall between 113% and 261.8% of the B-to-C leg.
- Alternating high and low structure is required. Malformed sequences are rejected.
- Bullish and bearish patterns are both supported. The newest valid pattern wins.
- Each pattern is traded once. After it closes, the same pattern is never re-entered.
- Patterns older than a configurable number of bars (default 100) are ignored, so the EA does not act on stale structure.
Trend filter
A 100 and 200 period moving average pair (fully adjustable, including the MA method) defines the dominant direction. Bullish patterns are only traded in an uptrend and bearish patterns only in a downtrend.
Trade construction
- Take profit is a Fibonacci projection: a configurable percentage of the AB leg projected from point C. The default is 161.8%. You can choose 127.2%, 200%, 261.8% or any value.
- The initial protective stop is placed at the tightest distance the broker allows, taking into account stop level, freeze level and an extra buffer in points. Every order is checked against the symbol's minimum distances before it is sent.
- Prices are normalised to the symbol's digits and the filling mode is set from the symbol's own specification.
Position sizing and margin protection
- Lot size is calculated from a percentage of account balance (default 1%) using the symbol's tick value and tick size, so it adapts to gold, forex majors and other instruments.
- Volume is normalised to the broker's minimum, maximum and step.
- Before each order, the EA calculates the margin that lot would need and caps the volume to a set fraction of free margin (default 30%). On very small accounts it can use most of the free margin safely instead of failing on an invalid volume.
- The symbol's aggregate volume limit is respected, so the EA does not run into "volume limit reached" rejections.
Recovery module
If the initial trade is stopped out, an optional recovery module can open a counter-trade at the C level with a structural stop beyond it (30% of the BC leg) and a Fibonacci target (61.8% of the BC leg by default).
- Lot multiplier is adjustable (default 1.5x).
- The number of attempts is capped (default 2).
- On hedging accounts the recovery trade opens alongside. On netting accounts the EA closes the net position first and confirms it is flat before opening, so it works on both account types.
- A stop that has been moved to breakeven or trailed into profit is never treated as a loss, so recovery is not triggered by a trade that closed flat or in profit.
- If a recovery cycle is left open without a position, an internal watchdog resets the state.
- Recovery can be switched off completely with one input.
Trade management
- Automatic move to breakeven once the trade reaches 1R.
- ATR-based trailing stop that begins after a configurable profit (default 1.5 ATR) and trails at a configurable distance (default 1 ATR). Both can be disabled.
Protection filters
- Volatility filter: skips patterns whose stop distance is too small or too large relative to ATR.
- Spread filter: blocks new entries when the spread exceeds your limit.
- Trading hours filter: optional start and end hour in server time.
- Friday cutoff: blocks new trades late on Friday to avoid weekend gap exposure.
- Daily loss guard: if equity drops by your chosen percentage from the day's starting equity, new entries and further recovery attempts are blocked for the rest of the day.
On-chart dashboard
A compact gold-on-charcoal panel shows the current trend, pattern status (scanning, pattern found, trade active), recovery state and attempt count, TP targets, balance and equity, today's profit and loss, live filter status, and whether the account is netting or hedging. A HIDE / SHOW button keeps the chart clean when you want it. Colours are adjustable.
Compatibility
- Works on MT5 netting and hedging accounts.
- Built for XAUUSD and major forex pairs. It adapts to any symbol with correct specifications.
- Attach to one chart per symbol. To trade several symbols, attach it to each chart with a different magic number.
- Uses only the standard MetaTrader library, with no DLLs and no external services.
- Passes Strategy Tester validation with margin, volume and stop-level checks built in.
Recommended approach
Start with default settings on a demo account, test on your broker's data in the Strategy Tester, then adjust risk, TP extension and recovery settings to your own tolerance. Test the timeframes and symbols you intend to trade rather than relying on one setup.
Risk disclosure
Trading involves substantial risk. The recovery module increases position size after a loss, which can raise exposure. Keep the attempt cap and risk percentage at levels your account can support, or disable recovery entirely. Past results do not guarantee future performance.
