Account protection Released Used by the author 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) →

Read this first. 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.

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

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.

Requirements

RequirementDetail
PlatformMetaTrader 5 (an .ex5 file; not MetaTrader 4).
SymbolGold 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 typeHedging or netting.
GDI KeyRequired to run it. The files are free to download.
Terminal settingsTools > 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

  1. Download the .ex5 file and, if you want the factory settings as a file, the .set file (links at the top of this page).
  2. In MetaTrader 5 choose File > Open Data Folder, open MQL5/Experts and copy the .ex5 there. Restart the terminal or right-click Expert Advisors in the Navigator and choose Refresh.
  3. Open Tools > Options > Expert Advisors, tick “Allow WebRequest for listed URL” and add https://sync.golddailyinsights.com.
  4. 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.
  5. On the Inputs tab choose Load and pick the .set file for the factory settings, then type your GDI Key into InpGdiKey. The key is never stored in the .set file.
  6. 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
  7. 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.

InputDefaultValuesWhat it doesWhen to use it, when not
InpOperatingMode1) Alert only (default): warns you, never closes anything1 = 1) Alert only (default): warns you, never closes anything
2 = 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.

InputDefaultValuesWhat it doesWhen to use it, when not
InpGdiKey(empty)textGDI KeyLeave 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).

InputDefaultValuesWhat it doesWhen to use it, when not
InpFilterModeMagic Number Only0 = Magic Number Only
1 = All Orders on Symbol
Which positions to watch on this chart's symbolMagic only is the safe choice. All orders on symbol also covers manual trades and other robots.
InpMagic0a numberMagic number to watch (0 = trades opened by hand)0 = trades opened by hand.
InpEnableTradingHoursfalsetrue or falseUse a trading-hours windowTurn on to keep trading inside a window.
InpTradeStartHour8a numberWindow starts at (hour, 0 to 23, broker time)Broker server time.
InpTradeEndHour18a numberWindow 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.

InputDefaultValuesWhat it doesWhen to use it, when not
InpLossModePercentage of Start-of-Day Balance0 = Cash Amount
1 = Percentage of Start-of-Day Balance
Limits are set asPercent of the start-of-day balance, or money.
InpEnableDailyLimittruetrue or falseUse a daily loss limit (drop from today's highest point)Leave at the default unless the group note above applies to you.
InpMaxDailyLoss5.0a numberDaily loss limit (percent or money, as chosen above)Drop from today’s highest point. 5 percent is a common ceiling.
InpEnableSessionLimittruetrue or falseUse a floating loss limit (open positions)Leave at the default unless the group note above applies to you.
InpMaxSessionLoss2.0a numberFloating loss limit (percent or money, as chosen above)Open (floating) loss. 2 percent is a tighter, trade-level limit.
InpNotifRisktruetrue or falseSend a message when a limit is reachedLeave 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.

InputDefaultValuesWhat it doesWhen to use it, when not
InpEnableLossCountfalsetrue or falseStop for the day after a number of losing trades (off by default)Leave at the default unless the group note above applies to you.
InpMaxLossCount5a numberLosing 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.

InputDefaultValuesWhat it doesWhen to use it, when not
InpEnableShutdownfalsetrue or falseAlso remove the other EAs (GDI collectors and monitoring tools always stay)Leave off unless you have checked the ignore list.
InpShutdownDelay2a numberSeconds to wait (keeping the symbol flat) before the other EAs are removedLeave at the default unless the group note above applies to you.
InpSlippage0a numberSlippage allowed when closing, in points (0 = automatic by symbol)Leave at the default unless the group note above applies to you.
InpIgnoreListFX Blue, GDI_Risk, GDI_Equity, GDI_Market_Assistant, GDI_OneFeed, GDI_MultiAccounttextMore 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.

InputDefaultValuesWhat it doesWhen to use it, when not
InpGlobalNotifRoutingPush Notification0 = None (Experts log only)
1 = Terminal Alert
2 = Push Notification
3 = Sound
4 = Email
5 = All Channels
Where messages goLeave at the default unless the group note above applies to you.
InpGlobalNotifSoundalert.wavtextSound 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 InpIgnoreList are 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

Used by the author 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