# FvgGold (MT5)

- **Upstream:** https://github.com/foeed/FvgGold-EA (commit `4fa57db`). Also listed free on the [MQL5 Market](https://www.mql5.com/en/market/product/186778).
- **Author / licence:** foeed, MIT
- **Platform:** MetaTrader 5 (`.mq5`, with `FvgGold.set` presets)
- **Market:** XAUUSD
- **Timeframe:** M15 entries, H1 bias. Intraday, not M1 scalping.

## Strategy

1. Finds Fair Value Gaps (3-candle imbalances) of at least 25 points, aged 2–20 bars.
2. Scores each gap 0–100: gap size (30), displacement of the impulse candle (30), H1 EMA50/200 alignment (20), freshness (10), premium/discount (10). An overlapping Order Block adds +20. Only gaps scoring ≥ 50 trade.
3. Trades only in killzones: London 07–10 GMT and the London/NY overlap 12–16 GMT.
4. Places a **limit order** at the gap edge. SL goes beyond the opposite edge plus a $3.00 buffer; TP = 1.5 × SL distance. Break-even at 0.5 × ATR.

## Risk controls (verified in code)

| Control | Default |
|---|---|
| Lot | Fixed 0.01 (`FixedLot=0` switches to risk %) |
| Risk % (if used) | 0.5% |
| Max concurrent trades | 1 |
| Daily loss limit | $5.00 |
| Stop-loss | Always set on the order |

No martingale, grid, averaging, or lot increase after a loss.

## Patch in this copy

- With `FixedLot=0`, if the risk-based lot is below the smallest valid volume, `CalcLot` returns 0 and the order is skipped. Upstream rounded it up.

## Known limits

- **No spread filter.** Spread is only used for the broker stop-level check. Avoid running it when gold spreads are wide (rollover, news).
- **Developer backtest is doubtful.** The README claims +$4,874 on $10,000 in 6 months at 0.01 lot over 64 trades. That is about $76 of gold movement per trade on average, which is not credible for stops of a few dollars. Re-test it yourself.
- **$50 account:** the stop is at least about $3.25, so one 0.01-lot loss ≈ 6.5%+ of $50. The default $5 daily limit is 10% of $50; set `DailyLossLimit` to 1.0 or less for a $50 account.

## Setup

1. Copy `FvgGold.mq5` to *MQL5/Experts* and compile (F7). Load `FvgGold.set` from the Inputs tab if you want the published presets.
2. Attach to **XAUUSD M15** and enable Algo Trading.
3. Check that the killzone hours match your broker's GMT offset.
