EA Circuit Breaker
- Utilities
- Version: 1.0
- Activations: 10
Most risk tools work on the whole account: trip one limit and every EA on it stops, even the ones that did nothing wrong. EA Circuit Breaker works on one EA at a time - its own row, its own four limits, its own outcome. By default nothing closes or stops, and it places no order of its own on a real account.
= EA Circuit Breaker
Account 75584608 Hedging JPY
Today -242056.00 Open 4 / 0.27 lots
NAME TODAY OPEN LIMIT STATE
Trend bot -19200.00 0/0.00 -22725.48 [#####-] WARN
Range bot -61250.00 0/0.00 -22725.48 [######] LOCKED
Swing EA -98335.00 0/0.00 -22725.48 [######] LOCKED
Gold scalper -2300.00 1/0.05 -5302.61 [###---] OK
Grid v3 -8180.00 2/0.20 -8711.43 [######] WARN
News EA -12540.00 1/0.02 -7953.92 [######] LOCKED
Selected Gold scalper magic 1720
Gold scalper Alert only
Daily Total Max pos lots
0.70 0.70 0 0.00
e.g. Mon-Fri 08:00-17:00 Link chart
Chart --
Unlock Reset total
Selected Grid v3 magic 1721
1.15 2.40 0 0.00
Warning: 94% of the daily limit used
= EA Circuit Breaker 4 LOCKED
Grid v3's gauge shows all six blocks filled, yet it's WARN, not LOCKED: the gauge has only six steps and rounds up near the limit, while the state is set by the limit itself - the warning line gives the exact percentage used. Today is larger than the six rows below it add up to: this account runs more EAs than the table shows at once, and Today - like the collapsed heading's LOCKED count - covers every EA on the account, not just the visible rows. The top three rows share one limit while Gold scalper's differs: the top three are still at default, and any row's limit works out to the same ratio of that row's own Daily figure, whatever the balance behind it - which never appears on screen. Max pos and lots both read zero: that limit is switched off, not "hold nothing," and both start off by default. Chart -- means no chart is linked yet, so Stop the chart can't be used.
It scans open trades and 30 days of history (InpHistoryDays) once on start, giving every magic number its own row - nothing to configure. A row's name is read from the comment that EA left on its own order, since MetaTrader keeps no list matching magic numbers to names. Trades with no magic number appear as Manual / unknown.
Each row carries four limits of its own - Daily and Total loss, a position count, a lot total - any switched off by leaving it at zero. A trading window (Mon-Fri 08:00-17:00 format) restricts when an EA may trade; left blank it means always, and an unreadable format is flagged red rather than ignored.
Three actions, chosen per EA. Alert only is the default (InpDefaultAction) - nothing closes, the row turns red, the reason is spelled out. Before any session's first automated action, the panel asks once more across its width and waits for that click (InpConfirmActions). Close and lock closes that EA's positions and cancels its pending orders but doesn't stop the EA - it keeps opening, this keeps closing what it opens, one spread cost per round, with the count and running cost shown and logged. Stop the chart removes that EA from the terminal for real, template saved first, but only once it's linked to a chart with Link chart - MetaTrader keeps no such map. It still works with Algo Trading off, unlike Close and lock. Manual / unknown can only be watched.
Selected News EA magic 1722
News EA Close and lock
1.05 3.70 0 0.00
Mon-Fri 08:00-17:00 Link chart
Chart USDJPY,H1
Daily loss limit reached - this EA is locked
Today -242063.00 Open 3 / 0.25 lots
Switching News EA to Close and lock drops Open by exactly what that one EA held, while Gold scalper's and Grid v3's own counts don't move at all - only the EA being acted on changes, and every other EA keeps trading.
A trading window releases itself once the clock is back in range. Daily loss, the position count and the lot total release at the same daily reset hour (InpDayResetHour). A total loss limit only releases on review, with Unlock pressed twice - which also restarts the running total from zero. Reset total does the same to the running total alone, without touching a lock.
Telling one EA's trades from another's only works on a hedging account; on a netting account everything for a symbol merges into one position. This tool checks the account type once the terminal has finished syncing, re-checking every second after, and on a netting account it falls back to watching only, shown on the panel:
Netting account: per-EA actions are disabled
Trades without a magic number are only watched, never stopped
First action of this session - press to allow it
It can't tell another EA to stop trading - no such call exists in MQL5 - so it can only keep closing what's reopened, or close the chart. Per-EA actions are unavailable on a netting account. With Algo Trading off, Close and lock can't run, though Stop the chart still can. Manual trades are only ever watched. It occupies one chart and refuses to start on a second. Two EAs sharing a magic number show up as one row.
The free demo runs inside the Strategy Tester, which gives only one EA - the situation this tool exists for can't arise there on its own. Inside the tester only, it opens a few small practice trades of its own under other magic numbers to fill the table, with Tester self-test shown throughout (InpTesterDemo); on a real account it never places an order of its own. What the tester can't show is one EA locked while others keep trading - that needs a demo account running two or three EAs.
Detection: InpHistoryDays InpIncludeManual
Default limits: InpLimitBase InpLimitUnit InpDefaultDailyLimit InpDefaultTotalLimit InpDefaultMaxPos InpDefaultMaxLots InpIncludeFloating InpWarnPercent InpDayResetHour
Action: InpDefaultAction InpConfirmActions InpSaveTemplate InpMaxCloseRetries
Alerts: InpAlertPopup InpAlertPush InpAlertSound
Tester: InpTesterDemo InpMagicSelf
Panel: position, width, font and six colours
Every row starts at its default limits, so every EA is already being watched from the first minute with nothing to set up. Names, limits, the trading window, chosen action, chart link, lock state and the running total's start date are all saved to a file per account number, surviving a timeframe change or a terminal restart. Built for MetaTrader 5 and a hedging account, on one free chart, with no DLL calls, no external requests and no external files.
This tool watches the EAs already running on the account and, once a limit and action are set, carries it out on the one that crossed it and writes down why - it never says what to trade, and it makes no claim about your results. Trading carries risk of loss; try a demo account first.
