Account protection Released I use this one myself, every day.
GDI Risk Management EA
Gold only. Daily loss limit, floating loss limit, losing trades per day and a trading-hours window. Alert only by default; it never opens a trade.
- Version4.02
- Last updated2026-12-02
- SymbolGold only: XAUUSD (any broker suffix) or GOLD
- TimeframeAny chart; the timeframe does not matter
Download GDI_Risk_Management_EA.ex5 ↓ Download the .set file ↓ Download the ZIP ↓ Get a GDI Key (7-day free trial) →
What it is
GDI Risk Management EA applies your own limits to the gold positions on the account: an optional trading-hours window, a daily loss limit (the drop from today’s highest point), a floating loss limit (open positions), and an optional number of losing trades per day. After the daily limit it can also remove other EAs from the charts.
It never opens a trade. Deposits, withdrawals and bonuses move the day’s base and peak, so they do not count as profit or loss. The day state survives a terminal restart.
What it can do
- Daily loss limit as a percentage of the start-of-day balance, or as money.
- Floating loss limit on the open positions.
- Optional limit of losing trades per broker day.
- Optional trading-hours window with an alert when it closes and reopens.
- Optional removal of other EAs after the daily limit (the GDI collectors and monitoring tools always stay).
- Alert only (default) or close the positions, chosen by the operating mode.
- Messages by push, e-mail, sound or terminal alert; an on-chart panel.
The operating modes
1) Alert only (default)
Every limit sends a message and leaves the positions open. Nothing is closed and no EA is removed.
Use it when: Use it to learn how your limits behave, or when you want a warning rather than an automatic close.
Do not use it when: Do not rely on it to cap a loss while you are away from the screen.
2) Automatic trading - standard
Every limit closes the positions it watches (the hours window closes the orders on this symbol while it is shut). If you also tick the removal option, other EAs are taken off the charts after the daily limit.
Use it when: Use it on a VPS or when you are not watching, once you have tested the limits on a demo account. Set the limits at a level you can live with.
Do not use it when: Do not turn on the removal of other EAs until you have checked that no robot you want to keep matches the ignore list. This EA has no light grid mode because it does not trade.
Risks
Gold (XAUUSD) is quoted as a CFD by most brokers. CFDs are complex instruments and carry a high risk of losing money quickly because of leverage. Most retail accounts lose money trading CFDs. Nothing on this page is financial advice and no result is promised or implied: past results do not guarantee future ones. Test on a demo account first and never risk money you cannot afford to lose.
- An EA can lose money faster than you can react, and a stop loss is not guaranteed: a gap or slippage can take a loss past your limit.
- If the terminal, the internet connection or the VPS is off, the EA does nothing. Only stops that sit on the broker’s server still work.
- The signal, the readings and the alerts are not advice. Read the Risk disclosure.
- This EA was compiled with 0 errors and 0 warnings. Behaviour with open positions, the dashboard on a live chart and the live licence were not exercised in a live account in this build: check everything on a demo account first.
Requirements
| Requirement | Detail |
|---|---|
| Platform | MetaTrader 5 (an .ex5 file; not MetaTrader 4). |
| Symbol | Gold only: XAUUSD with or without a broker suffix, or GOLD. On any other symbol the EA refuses to start. It adds nothing else to Market Watch. |
| Account type | Hedging or netting. |
| GDI Key | Required to run it. The files are free to download. |
| Terminal settings | Tools > Options > Expert Advisors: tick “Allow WebRequest for listed URL” and add https://sync.golddailyinsights.com. |
Download and licence
Free to download: GDI_Risk_Management_EA.ex5 (compiled program), GDI_Risk_Management_EA.set (every input at its factory value, GDI Key empty) and GDI_Risk_Management_EA.zip (both files and an install note). Running it needs a GDI Key typed into InpGdiKey. The licence is checked at start and every hour; a lapsed key pauses new trades and never closes positions that are already open.
Build check: compiled with MetaEditor, 0 errors and 0 warnings. SHA-256 of the .ex5: ed964d71b2c949045ddfe7dfcd0162b38c2ee957e67429e546bcfa0409841947. Compare it with the file you downloaded if you want to be sure it is unchanged. How the key works: GDI Key and licence check.
Installation and first run
- Download the
.ex5file and, if you want the factory settings as a file, the.setfile (links at the top of this page). - In MetaTrader 5 choose File > Open Data Folder, open
MQL5/Expertsand copy the.ex5there. Restart the terminal or right-click Expert Advisors in the Navigator and choose Refresh. - Open Tools > Options > Expert Advisors, tick “Allow WebRequest for listed URL” and add
https://sync.golddailyinsights.com. - Open a gold chart (XAUUSD, with or without your broker’s suffix, or GOLD) and drag the EA onto it. The EA refuses to start on any other symbol.
- On the Inputs tab choose Load and pick the
.setfile for the factory settings, then type your GDI Key intoInpGdiKey. The key is never stored in the.setfile. - On the chart’s Common tab tick “Allow Algo Trading” only if you use a mode that closes or trades; Alert only does not need it
- Open the Experts tab: you should see the licence confirmed and then the EA’s own status messages.
Inputs explained, one by one
Inputs are listed in the order MetaTrader 5 shows them, from the top. Values in code are what you can type; the bold default is the factory setting in the .set file. The key input is secret: type your GDI Key on the Inputs tab, never into a file or a screenshot.
Operating mode
When to use this group: Choose Alert only to be warned, or Automatic trading - standard to let the EA close positions at each limit.
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpOperatingMode | 1) Alert only (default): warns you, never closes anything | 1 = 1) Alert only (default): warns you, never closes anything2 = 2) Automatic trading - standard: closes positions when a limit is reached | Operating mode (this EA never opens trades; there is no grid mode) | Leave at the default unless the group note above applies to you. |
GDI Key
When to use this group: Your licence key.
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpGdiKey | (empty) | text | GDI Key | Leave at the default unless the group note above applies to you. |
What to watch
When to use this group: Which positions are watched and the optional trading-hours window (broker time).
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpFilterMode | Magic Number Only | 0 = Magic Number Only1 = All Orders on Symbol | Which positions to watch on this chart's symbol | Magic only is the safe choice. All orders on symbol also covers manual trades and other robots. |
InpMagic | 0 | a number | Magic number to watch (0 = trades opened by hand) | 0 = trades opened by hand. |
InpEnableTradingHours | false | true or false | Use a trading-hours window | Turn on to keep trading inside a window. |
InpTradeStartHour | 8 | a number | Window starts at (hour, 0 to 23, broker time) | Broker server time. |
InpTradeEndHour | 18 | a number | Window ends at (hour, 0 to 23, broker time) | Leave at the default unless the group note above applies to you. |
Loss limits
When to use this group: The two main limits. A daily limit of 5 percent and a floating limit of 2 percent are the factory values.
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpLossMode | Percentage of Start-of-Day Balance | 0 = Cash Amount1 = Percentage of Start-of-Day Balance | Limits are set as | Percent of the start-of-day balance, or money. |
InpEnableDailyLimit | true | true or false | Use a daily loss limit (drop from today's highest point) | Leave at the default unless the group note above applies to you. |
InpMaxDailyLoss | 5.0 | a number | Daily loss limit (percent or money, as chosen above) | Drop from today’s highest point. 5 percent is a common ceiling. |
InpEnableSessionLimit | true | true or false | Use a floating loss limit (open positions) | Leave at the default unless the group note above applies to you. |
InpMaxSessionLoss | 2.0 | a number | Floating loss limit (percent or money, as chosen above) | Open (floating) loss. 2 percent is a tighter, trade-level limit. |
InpNotifRisk | true | true or false | Send a message when a limit is reached | Leave at the default unless the group note above applies to you. |
Losing trades per day (optional)
When to use this group: Optional. Off by default.
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpEnableLossCount | false | true or false | Stop for the day after a number of losing trades (off by default) | Leave at the default unless the group note above applies to you. |
InpMaxLossCount | 5 | a number | Losing trades allowed per broker day (the next one is not allowed to stay open) | Leave at the default unless the group note above applies to you. |
After the daily limit is reached
When to use this group: Optional removal of other EAs. Off by default; read the ignore list first.
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpEnableShutdown | false | true or false | Also remove the other EAs (GDI collectors and monitoring tools always stay) | Leave off unless you have checked the ignore list. |
InpShutdownDelay | 2 | a number | Seconds to wait (keeping the symbol flat) before the other EAs are removed | Leave at the default unless the group note above applies to you. |
InpSlippage | 0 | a number | Slippage allowed when closing, in points (0 = automatic by symbol) | Leave at the default unless the group note above applies to you. |
InpIgnoreList | FX Blue, GDI_Risk, GDI_Equity, GDI_Market_Assistant, GDI_OneFeed, GDI_MultiAccount | text | More EAs that stay (part of the name, comma separated) | Parts of EA names that must stay, separated by commas. |
Messages
When to use this group: Where the messages go.
| Input | Default | Values | What it does | When to use it, when not |
|---|---|---|---|---|
InpGlobalNotifRouting | Push Notification | 0 = None (Experts log only)1 = Terminal Alert2 = Push Notification3 = Sound4 = Email5 = All Channels | Where messages go | Leave at the default unless the group note above applies to you. |
InpGlobalNotifSound | alert.wav | text | Sound file (when sound is chosen) | Leave at the default unless the group note above applies to you. |
Frequently asked questions
- Does it open trades?
- Never.
- Do deposits and withdrawals count as a loss?
- No. They move the base and peak of the day and are not counted as profit or loss.
- What does the removal of other EAs do?
- After the daily limit, and only if you tick it, it removes other EAs from the charts after a short delay. GDI collectors, monitors and the names in
InpIgnoreListare spared. It was tested with a test EA in the Strategy Tester, not on live charts. - Which symbols?
- Gold only. On any other symbol it refuses to start.
- Does it guarantee that a loss stops at the limit?
- No. A fast market, a gap or slippage can take the loss past the limit before the EA acts.
The Author’s Kit
Four of the GDI Expert Advisors are the ones I run on my own accounts: the Signal Copier, Equity Management, Risk Management and the Market Assistant. Together they cover copying, protecting the account, controlling risk and reading the market. All four are covered by a GDI Key; see GDI Key for the plans.
Other manuals
Trading carries risk. An EA can lose money, and nothing here is advice. Risk disclosure
Next steps
GDI Key and plans Getting started Ask a question All GDI EAs
Version 4.02, last updated 2026-12-02.
GDI Signal online (web version): follow the signal from any browser or phone, with e-mail alerts straight from the server and no VPS or computer left switched on. Automatic copying into your own account still needs MetaTrader 5 running with the GDI Signal Copier EA. Open GDI Signal online