Gold Trend Sentinel MT4
- Experts
-
Allan Aparece Ninal
Sviluppo indicatori ed Expert Advisor per MetaTrader 5.
Come lavoro:
- Ogni indicatore viene controllato contro il repainting: i segnali vengono decisi solo su barre chiuse, e un test su ogni tick conferma che non cambiano in seguito. - Versione: 1.20
Gold Trend Sentinel MT4 is an Expert Advisor for XAUUSD on MetaTrader 4 that trades a trend rule on the H4 chart. It uses a fixed 0.01 lot (or the broker's minimum), a stop on every order and a trailing stop. It suits traders who want a simple, rule-based gold trend follower.
This EA promises no profit. Gold can move against any trade. Every result below is a backtest, not live trading.
Built for gold. Gold is what this EA was designed and tested on, and the tests cover only that setting. The tested setting is XAUUSD with the default inputs. It will also trade other symbols, but those were not tested.
MetaTrader 4 edition: the same rule, panel and inputs as the MetaTrader 5 version. The rule passed the same criteria again in the MetaTrader 4 Strategy Tester; the numbers are below.
Quick start
- Open an XAUUSD chart (a prefixed or suffixed name is fine) and attach the EA from the Navigator. Keep AutoTrading enabled.
- Keep the default inputs: they are the rule as tested, and the signal timeframe is already H4.
- Read the Risk row on the panel. It shows what the 0.01 lot loses if the stop is hit, as a percent of balance. Test on a demo account first.
Standalone: everything is built in. You do not need to buy or install any other product named on this page.
What you see on the chart
- A status panel: both trend filters and what the EA may do now. It also shows the open trade and its trailing stop, with the UT Bot line marked where it flips.
- A Risk row: what the 0.01 lot loses if the stop is hit, as a percent of balance.
The rule
- It reads the last closed H4 bar, once per bar.
- Buy: the close crosses above the UT Bot trailing line (key value 1.5, ATR 10). The last completed daily close must be above its 200-day EMA. Supertrend (10, 3) on H4 must point up. Sell is the mirror image.
- The stop is 3 x ATR(14) from the entry. Each new H4 bar it moves to 3 x ATR behind the most favourable price since entry, only in the trade's favour. There is no take profit.
- One position at a time. An opposite signal closes the trade and opens the other way. A same-side signal is ignored.
Expect few trades: all three conditions agree roughly 17 times a year in the 2021-2026 history.
Risk handling
Before each order the EA checks free margin, the broker's stop and freeze levels, and that the account would survive the stop. If not, the order is skipped and the panel says why. No grid, martingale or averaging.
The stop on gold is large: in 2026 about 115 USD per 0.01 lot. The Risk row shows its share of your balance (Safe up to 1%, Medium 2%, High 3%, Very high 5%, Extreme above). As a guide, about 12,000 USD gives roughly 1% per trade, 6,000 USD 2%, 2,300 USD 5%. With a 0.10 minimum lot, multiply these by ten.
Who it is for / not for
For traders who want a simple, rule-based gold trend follower with the lot size fixed, and who will test it on demo first. Not for anyone who wants frequent trades, a take-profit target, other symbols, or risk-based sizing.
Inputs
| Input | Default |
|---|---|
| Magic number; signal timeframe | 770100; H4 – order ID and the timeframe the rule is read on |
| UT Bot key value and ATR period | 1.5 and 10 – the trailing line |
| Supertrend ATR period and multiplier | 10 and 3.0 – the Supertrend filter |
| Daily trend EMA period | 200 – the daily close must be on the trade's side |
| Stop ATR period; stop and trail, x ATR | 14; 3.0 – first stop and trail distance |
| Trail the stop | true – off keeps the first stop |
| Broker server clock; offset from UTC | Auto; 0 – candle alignment (Auto, New York close, European, Fixed offset); hours, Fixed offset only |
| Display group | panel and UT Bot line on, dark colours, top left, margins 10 and 26 px, font 9 |
| Dry run: alert each signal, open no trades | false – when on, no trade is opened; each signal is sent as an alert |
| Dry run: pop-up alert with sound | true – pop-up with sound; used only when dry run is on |
| Dry run: push to phone | true – needs your MetaQuotes ID; used only when dry run is on |
| Debug log for bug reports | false |
The defaults are the rule as tested. There is no set file; keep them.
Use and limits
- It trades on any symbol by default. XAUUSD charts, including prefixed or suffixed names, are what it was tested on.
- It works on any MetaTrader 4 account. Candles are rebuilt on the New York-close clock if the broker's differs.
- It has no trade alerts, news filter, time filter or buttons. The dry-run signal alerts are included.
- Keep AutoTrading enabled and the terminal running, or use a VPS. New trades and the trail need it.
Automatic trading or signals only
By default the EA trades by itself: it opens each trade when its rule fires and manages the stop. If you prefer to decide each entry yourself, set "Dry run: alert each signal, open no trades" to true.
- With dry run on, the EA opens no trade and changes no stop. Each signal arrives as one alert. It gives the direction, symbol, timeframe, price, stop-loss, take-profit (where the rule has one) and the lot size the EA would have used.
- The alert is a pop-up with sound in the terminal and/or a push notification to your phone. Both are on when dry run is on. Switch either one off in the inputs. Each signal is also written to the Experts log.
- You review the signal on your side and decide whether to enter by hand.
- For push on your phone: install the MetaTrader mobile app, find your MetaQuotes ID in its settings, and enter it in the terminal under Tools > Options > Notifications.
- In dry run the EA does not manage trades, including trades you open by hand.
- Dry run is off by default. In the Strategy Tester it only writes to the log.
How it was checked
- Code checks: the EA's indicator code, copied line for line into a Python test, gave the same 112 signals as the research rule. This used H4 broker history, October 2021 to October 2026. Its trade handling matched the research engine on 85 of 85 trades.
- MetaTrader 4 Strategy Tester: entries July 2023 to September 2026, every tick from 1-minute broker prices. The tester takes one fixed spread per run. So the period ran in two parts: 170 points to September 2025 and 20 points after, the typical gold spread in each part. All 74 signals matched the Python model; 57 trades against its 58, the missing one opened on the last day of the test. Average +0.43 R per trade (t 2.53), profit factor 2.86 in R, positive in both halves. A backtest, not live trading.
- Backtest, not live trading: Python, XAUUSD broker history, October 2021 to October 2026, fixed 0.01 lot, with spread, commission, slippage and swap included. Result: 85 trades, net result +1,340 USD from 10,000 USD, profit factor 2.04, worst balance drawdown 5.4%. The rule was chosen on 2010-2023 research and judged once on 2024-2026. So this is not new out-of-sample evidence. Profit came from buys in a rising gold market. Sells lost slightly. A forward test on new data started in October 2026 and is not finished.
- The demo of this product runs in the Strategy Tester only.
How to test in the Strategy Tester
- Open the Strategy Tester (Ctrl+R, or View > Strategy Tester).
- Choose Expert Advisor, then Gold Trend Sentinel MT4.
- Set Symbol and Period to those of the preset you want to test.
- Set Model to "Every tick", the model my tests used. It needs 1-minute history for the period.
- Tick Use date and choose a range, for example 2023.07.01 to 2026.10.01.
- Set Spread. My test used 170 points to September 2025 and 20 points from October 2025 on XAUUSD, as two separate runs.
- Click Expert properties. On the Testing tab, use a deposit close to your own account. On the Inputs tab, make the changes below.
- Click Start.
| Preset | Inputs to change from the defaults |
|---|---|
| XAUUSD H4 | None |
The default inputs already are the XAUUSD H4 preset, so that one needs no changes.
You can try other settings the same way. The tester ignores any live-only option, and a test of other settings is not a validated preset. A backtest describes the past only.
Works well with
These are workflow suggestions. I have not found that any pair gives better trading results. You do not need any of them.
Do not run this EA under a tool that closes trades at prop-firm limits. The EA does not read such a lock. After the tool closes its trades, the EA can open new ones and the tool closes them again. Rely on the EA's own stop loss and fixed lot instead.
| Product | How to use them together | Why |
|---|---|---|
| UT Bot Signal Alerts MT4 | Put it on the H4 chart with key value 1.5 and ATR period 10. | You see the UT Bot line the EA uses. The EA has it built in, so the indicator is optional. |
| SuperTrend Signal Alerts MT4 | Add it to the same H4 chart. | You see a SuperTrend line like the one in the EA's trend filter. The EA has it built in. |
| EA Health Monitor MT4 | Give the EA its own magic number in its inputs. Attach the monitor to one chart of the account. | It shows one row per magic number, so you can read this EA's trades on their own. |
| Prop Rules Monitor MT4 | Attach it to one chart of the account while the EA runs. | It shows your distance to a prop firm's limits. It only watches and never closes anything. |
Several gold Expert Advisors follow the same market. Running them together adds to one exposure; this is not a tested diversification.
Related products
- Gold Trend Sentinel: the same Expert Advisor for MetaTrader 5.
- UT Bot Signal Alerts MT4: draws the same UT Bot line and arrows on your chart; this EA uses key value 1.5 and ATR period 10.
- SuperTrend Signal Alerts MT4: a SuperTrend line with alerts; this EA uses a Supertrend filter on H4.
- All my products on MQL5
FAQ
Does it repaint? No. Decisions use closed bars only.
Other symbols? It will trade them by default, but they were not tested.
Why no trade this week? All three conditions must agree; the panel shows which one blocks.
How do I report a problem? Set the debug log to true, repeat it, and send the DBG lines (Journal tab in the tester), your inputs and a screenshot. Set it back to false afterwards.
Reporting a bug or error
- In the inputs, set "Debug log for bug reports" to true.
- Leave the EA running until the problem happens.
- Open the Experts tab in the Terminal window (Ctrl+T), right-click in the log and choose Copy (or open the log folder from the same menu).
- Send it as a comment on this product page or as a LinkedIn message, with the symbol, timeframe, EA version and what you expected to happen.
The debug log never contains your login, name, server, balance or equity. Set it back to false afterwards.
If it helps your trading, a short review on this page helps other traders find it.
Questions: use the comments on this page or send me a message on MQL5.
Trading gold carries a risk of loss, and past results do not predict future results.
