Isobar Event Shield
- Utilities
-
Syarief Azman Bin Rosli
Hello and welcome to my official MQL5 profile!
I am Syarief Azman Bin Rosli, an algorithmic trading systems developer and quantitative software engineer with over a decade of specialized experience creating robust automated trading solutions for MetaTrader 5 and MetaTrader 4. - Version: 1.0
- Activations: 5
Isobar Event Shield protects your trades from economic news in MetaTrader 5. It reads the terminal's built-in economic calendar, counts down to every release that affects your symbols and, shortly before each release, applies the protection you choose to the positions and pending orders that you or your other Expert Advisors already have. It never opens trades of its own.
Quick Start
- Attach the utility to one chart (one copy per terminal) and enable Algo Trading in the terminal toolbar.
- The base and quote currencies of the chart symbol are watched automatically. Add more in Extra Currencies to Watch (for example USD,EUR,JPY) and keep Protection Scope on Linked to protect every symbol that uses them.
- Choose Open Position Action and the window length (Window Opens and Window Closes, default 15 and 10 minutes).
- Leave the panel on the chart. When a window opens the shield acts by itself; when it closes, parked pending orders are placed again.
- To see it work, enter a manual event a few minutes ahead in server time, for example 14:35 USD Test, and watch the status change to SHIELD ACTIVE.
Panel Buttons
- [-] / [+]: collapse the panel into a small pill that shows the countdown, or expand it again.
- <>: move the panel to the next chart corner (top left, top right, bottom right, bottom left).
- SHIELD NOW: run the position action and park pending orders immediately for the current scope (with Linked: every symbol that uses a watched currency). Orders parked this way return after the current or next release window if it starts within the Threat Meter Horizon, otherwise after Window Closes minutes.
- FLATTEN SCOPE: close every position in scope. The first click arms it (the button shows CONFIRM FLATTEN ?), a second click within 4 seconds executes. Pending orders are not touched.
- AUTO ON / OFF: with OFF the utility only monitors. Countdowns and alerts continue, but no position or order is changed when a window opens.
- IMPACT HIGH / MED+ / ALL: minimum importance used by the radar, the windows, the alerts, the chart lines and the lock flags.
- SYMBOL / LINKED / ACCOUNT: protection scope, explained below.
- HARD ON / OFF: hard blackout, explained below. It works independently of AUTO.
Button changes stay in effect while the utility runs, including after a timeframe or symbol change. Changing inputs or attaching it again restores the input values.
Panel Readouts
- Status badge: ALL CLEAR (no window soon), SHIELD ARMED (the next window starts within the alert lead time), SHIELD ACTIVE (a window is open), WINDOW OPEN (a window is open while AUTO is OFF), MONITOR ONLY (AUTO is OFF), ALGO TRADING OFF (the shield cannot act until Algo Trading is enabled), NO EVENT FEED (calendar unavailable and no manual events), TESTER MODE. The LED and the left accent bar use the status color, and the LED blinks while a window is open.
- Line next to the badge: AUTO or MANUAL, the position action and the window minutes, for example 15/10m.
- NEXT RELEASE card: currency and event name, a large countdown (T- before the release, T+ after it), the server clock, the window times and a THREAT meter that rises from 0% (window still Threat Meter Horizon minutes away) to 100% (window open).
- EVENT RADAR: the next five releases. Each row shows an importance square (red high, amber moderate, grey low), day, time, currency, name, values (F forecast, P previous, A actual once published) and the time left. LIVE means its window is open. The corner shows the feed status (CAL ONLINE and the number of events, CAL ERROR and an error code, or TESTER: MANUAL FEED) and the impact filter.
- EXPOSURE: positions, lots, floating profit including swap, pending orders and parked orders, counted for the current scope and magic filter, plus the chart symbol's spread in points. SPREAD LOAD compares the spread with its normal level, which is learned outside windows (x3.0 means three times normal; BASE is the normal spread).
- Bottom line: the last action or alert.
- On the chart: a dotted vertical line with the event name at each upcoming release, and a shaded zone covering its window (red high, amber moderate, slate low). Labels that would overlap are stacked, and hovering a line shows the event and its time.
What Happens in a Window
When a window opens, the Open Position Action runs once per release on every position in scope that matches the magic filter:
- Alert only (no position changes).
- Lock winners at breakeven + buffer: positions that are at least Minimum Profit Before Breakeven Lock points in profit get their stop loss moved to entry plus Breakeven Lock Buffer. A better existing stop is kept, stop and freeze levels are respected, and losing positions keep their own stops.
- Reduce exposure by %, then lock breakeven: closes Exposure Reduction percent of each position (rounded down to the volume step and skipped if the remainder would fall below the minimum lot), only once per window, then applies the breakeven lock.
- Bank positions that are in profit: closes positions whose profit plus swap is positive.
- Close every position in scope.
With Park Pending Orders on, pending orders in scope are removed and stored with all their settings. After the window they are placed again unchanged. An order is dropped, with a log entry, if its price was crossed or it expired during the window. If the market is closed, the connection is lost or Algo Trading is off, the order is retried every 60 seconds. With Re-Arm Parked Orders off, removed orders are cancelled for good. Parked orders are saved in MQL5\Files and are placed again when the utility is attached to the same symbol after a restart.
Hard blackout: while a window is open, every new position on an affected symbol is closed immediately (on netting accounts only the added volume) and every new pending order is parked until the window ends. This covers manual trades and other Expert Advisors that match the magic filter. Without it, positions opened during a window are not touched.
Alerts are sent before each release (Pre-Release Alert Lead), when the shield acts, when a window opens while AUTO is OFF, when a new entry is rejected, and when parked orders are placed again.
Protection Scope
- Symbol: only the chart symbol.
- Linked: every symbol whose base or quote currency is the currency of the release.
- Account: every position and order on the account.
Magic Filter: -1 for all trades, 0 for manual trades only, any other value for the Expert Advisor with that magic number.
Manual Events
Enter events separated by semicolons, in server time. Use yyyy.mm.dd hh:mi CCY Label for one date, or hh:mi CCY Label to repeat every day. CCY is a three-letter currency or ALL for the whole account. Manual events always count as high importance and are the only feed in the Strategy Tester.
Example: 2026.10.09 15:30 USD FOMC Minutes; 21:55 ALL Rollover
Pausing Your Own Expert Advisors
Isobar publishes terminal global variables that any Expert Advisor can read: ISOBAR_LOCK (1 during any window), ISOBAR_LOCK_ plus each watched currency (for example ISOBAR_LOCK_USD), ISOBAR_LOCK_ plus the chart symbol (for example ISOBAR_LOCK_EURUSD) and ISOBAR_NEXT_SEC (seconds to the next release, -1 if none). They are deleted when the utility is removed. Add this line before the entry logic of your EA:
if(GlobalVariableCheck("ISOBAR_LOCK") && GlobalVariableGet("ISOBAR_LOCK") > 0.5) return;
Typical Setups
- Protect manual trades (defaults): Lock winners at breakeven + buffer, Park Pending Orders on, scope Linked.
- No open trades around high-impact news (for example a prop firm rule): Window Opens 2, Window Closes 2, Close every position in scope, Hard Blackout on, scope Entire account.
- Pause another EA without touching its trades: Alert only (no position changes), Park Pending Orders off, and read ISOBAR_LOCK in that EA.
- Halve the risk on a basket: Reduce exposure by %, then lock breakeven, Exposure Reduction 50, Extra Currencies to Watch USD,EUR,GBP,JPY.
Input Parameters
Economic Calendar Radar
- Minimum Event Importance (High importance only): the other options are Moderate and high importance, and All events.
- Extra Currencies to Watch (empty): comma-separated currency codes.
- Radar Lookahead (36): hours ahead to load, 1 to 168.
- Calendar Refresh Interval (60): seconds between calendar reloads, minimum 15.
- Manual Events (empty): see Manual Events.
Shield Window
- Window Opens (15) and Window Closes (10): minutes before and after the release, 0 to 240.
- Auto-Execute Shield When Window Opens (true): starting value of the AUTO button.
- Protection Scope (Every symbol sharing the event currency): starting value of the scope button. The other options are Chart symbol only and Entire account.
- Magic Filter (-1).
Shield Policy
- Open Position Action (Lock winners at breakeven + buffer).
- Breakeven Lock Buffer (20) and Minimum Profit Before Breakeven Lock (50): in points.
- Exposure Reduction (50): percent of volume closed by the reduce action.
- Park Pending Orders During Window (true) and Re-Arm Parked Orders After Window (true).
- Hard Blackout: Reject New Entries In Window (false): starting value of the HARD button.
- Max Slippage for Closes (30): points.
Alerts
- Pre-Release Alert Lead (30): minutes before a release, 0 turns it off.
- Terminal Pop-Up Alerts (true), Sound Alerts (true), Push Notifications to Mobile (false; requires a MetaQuotes ID in the terminal notification settings).
Cockpit & Chart Overlays
- Cockpit Dock Position (Top left), Horizontal Margin (16) and Vertical Margin (28): panel position in pixels.
- Threat Meter Horizon (120): minutes covered by the THREAT meter and by SHIELD NOW parking.
- Draw Release Lines & Blackout Zones (true) and Max Events Drawn On Chart (6).
- Publish Lock Flags as Global Variables (true).
Notes
- Works on hedging and netting accounts and on any symbol whose currencies appear in the calendar (forex, metals, indices, energies).
- Every request is checked against stop and freeze levels, volume limits and OrderCheck before it is sent. No DLLs and no web requests are used, and all chart objects are removed with the utility.
Risk Disclaimer
Isobar Event Shield is a risk management tool. It cannot prevent slippage, gaps or spread widening around news and does not guarantee profits or the avoidance of losses. Test your settings on a demo account before using them on a live account.
