NewsGuard Economic News Guard for Positions MT5
- Utilities
-
Ibrahim Yahya
I build MetaTrader 5 tools that follow your rules exactly: Expert Advisors, trade managers and trade copiers that size every trade from your risk and manage it to the end, unattended on a VPS.
What I have built and run: - Version: 1.0
- Activations: 5
NewsGuard protects your open positions from news spikes. You attach it to one chart, and it reads the economic calendar built into MetaTrader 5. When an important event for your currencies is close, it looks after the positions you choose: it warns you, secures them with a break-even stop, or closes them. It does not open trades and it does not generate signals.
What it does
- Guards positions around news. Inside a window (by default 15 minutes before to 15 minutes after the event) it applies the action you chose to your positions.
- Three actions. 1 = warn only: a pop-up alert, an optional push notification, the panel turns red, and a position opened inside the window is reported once. 2 = secure: the stop moves to break-even (entry +/- InpBEPoints) for positions that are in profit by more than that; other positions are left alone. 3 = close every position in the filter.
- Built-in calendar. No web requests and no DLLs. Importance: high only, or high and medium. Currencies: by default the base and profit currency of the chart symbol (gold and silver also get USD), or your own list. The event list is refreshed every 5 minutes and looks 48 hours ahead by default.
- You choose the positions. Every position, manual trades only, or one EA's magic number. Every symbol, or only the chart's symbol.
- Panel. Status, next or current event, currency, impact, server and UTC time, countdown, the active rules, the last action and the calendar status.
- Notifications. Pop-up alert at the start of a window and an optional push message to the MetaTrader mobile app.
Honest limits
- NewsGuard cannot stop another EA, or you, from opening a trade inside the window. With action 3 it closes such a position at the next tick (live: one pass per second). The position can exist for a moment and the spread is paid. Action 1 only reports it.
- The calendar is the broker's built-in MT5 calendar, in broker server time. The panel shows both server and UTC time and the calendar status.
- Break-even needs room: the new stop must be at least the broker's minimum distance away from the price, otherwise the position is retried on the next pass.
- If an event is re-timed after its window has started, it is not re-planned until the next refresh.
- Stops and closes are market operations. There is no guarantee against slippage, gaps or price spikes: the price can pass a stop before it is moved or filled.
- It works only while the terminal and the EA are running. A VPS keeps them running.
How to use it
- Attach NewsGuard to one chart (any symbol, any timeframe). Attach it once: one copy guards all the positions you select.
- Allow Algo Trading in the terminal and in the EA's settings.
- Choose the importance, the window (minutes before and after) and the action: 1, 2 or 3. The default is 1, warn only, so you can watch it first.
- Choose which positions it guards (all, manual only, or one magic number).
- Keep the terminal running. For push messages, enter your MetaQuotes ID in Tools > Options > Notifications and set InpPush to true.
In the Strategy Tester there is no economic calendar. With the default inputs (InpTestEvent empty), NewsGuard places a demo event every weekday at 12:00 server time and opens minimum-lot demo BUY and SELL trades around it, so that you can see the guard at work in visual mode. If the action input is 1, it is forced to 3 (close) in the tester, so that the effect is visible. This happens only in the tester. On a live or demo account NewsGuard never opens a trade of its own. In the tester you can also set your own event with InpTestEvent. On a live chart InpTestEvent gives a preview that only warns and never trades.
Inputs
| Input | Default | What it does |
| InpImportance | High only | High only, or high and medium |
| InpCurrencies | (empty) | Currencies, e.g. USD,EUR. Empty = the chart symbol's currencies (gold and silver also USD) |
| InpLookAheadHours | 48 | How many hours ahead events are listed |
| InpMinBefore | 15 | The window starts this many minutes before the event |
| InpMinAfter | 15 | The window ends this many minutes after the event |
| InpAction | 1 (warn) | 1 = warn only, 2 = break-even, 3 = close all |
| InpBEPoints | 10 | Action 2: the stop goes to entry +/- this many points |
| InpSymbols | ALL | ALL symbols, or only the chart's symbol |
| InpMagic | -1 | -1 all positions, 0 manual trades only, N one EA |
| InpAlert | true | Pop-up alert at the start of a window |
| InpPush | false | Push notification to the mobile app (needs the MetaQuotes ID) |
| InpUtcOffset | 99 | Server UTC offset in hours for the panel, 99 = auto detect |
| InpDarkChart | false | Recolour this chart dark |
| InpShot | false | Save a screenshot to MQL5\Files 6 seconds after start |
| InpTestEvent | (empty) | Tester: fake event as YYYY.MM.DD HH:MM (server time) or +N minutes. Live chart: preview, warn only |
| InpTestTrades | false | Tester only: demo trades around the fake event |
FAQ
Does NewsGuard open trades or give signals?
No. It only watches and manages positions that you or another EA opened. The only trades it opens are the demo trades in the Strategy Tester.
Can it prevent a trade from being opened during news?
No. It cannot block another EA or you. With action 3 it closes such a position at the next tick or second, and the spread is paid. With action 1 it only reports it.
Does it protect me from slippage and gaps?
No. It reduces the time your positions stay exposed, but stops and closes are executed at market. A spike can pass a stop, and nothing here is a guarantee or a promise of results.
Which time zone does the calendar use?
The broker's server time. The panel shows the event in server time and in UTC, and the detected server offset.
Does it work with other Expert Advisors?
Yes. Use the magic filter: -1 for all positions, 0 for manual trades only, or one EA's magic number.
Why was break-even not applied?
Break-even is applied only when the position is in profit by more than InpBEPoints, and the new stop must be at least the broker's minimum distance from the price. Otherwise the position is left alone or retried on the next pass.
