Copy PIPIT_GOLD.ex5 into MQL5\Experts, restart the terminal or refresh the Navigator.
Open a gold (XAUUSD) chart on H1.
Drag the EA onto the chart, tick Allow Algo Trading, keep the defaults and press OK.
Run it on a demo account first: tester results are not a forecast and the live fill path has not been tested.
2. Settings: start at the top
Lot size: lot 0.01 per $1,000 of balance, capped at 0.10. This is the setting to review first.
All other inputs are research settings. Leave them at their defaults.
3. What it does, in order
Levels. Daily highs and lows from the last 14 days that price has not traded through, and that stand out as wide swings on the hourly chart (20 hourly bars with nothing higher or lower before it, between 14 and 130 hourly bars old).
Approach. When price comes within about $6.75 of a level, pending stop orders are placed a fixed fraction of a percent inside it. After a trade closes, the same level and setting can be used again, up to two more times.
Eight order settings. Three for sells and five for buys, each with its own stop ($1.80 to $2.30) and target ($13 to $21).
Trailing stop. After a fill the stop moves to just above entry and then follows price at about 0.71 of the profit beyond the first dollar.
Sizing. The lot is 0.01 per $1,000 of balance, capped at 0.10 lots.
4. How much money do I need? (minimum balance)
The research run started from $10,000. The largest single loss in that run was about $79.
At 1:30 leverage 0.01 lot needs about $150 of margin with gold near $4,500; a small account has little room for a losing run.
5. When it will not trade
On Fridays after 22:00 server time (pending orders are cancelled).
When no recent daily high or low qualifies as a wide hourly swing.
When the market is closed or the spread is above the limit.
On a broker whose server clock differs from the tested one, session timings shift. Test on a demo account with your broker.
6. Known limits
It earns mainly in fast gold. Replays of 2022 to early 2025 gold were flat or lost money in several quarters.
Trades last seconds, so slippage and requotes in fast markets can be much larger than in the tester.
The lot is capped at 0.10; larger sizes were not tested.
Several orders can fill together: up to ten positions were open at once in the test, each with its own hard stop. This is not averaging, but a fast reversal can hit several stops together.
Backtest results only; there is no live record yet.