News Pause Guard
- Utilities
-
Kazuma Uezono
MQL5 / MQL4 / Pine Script v6 developer and active trader.
Seller on the MQL5 Market (indicators for MT4/MT5).
Services:
- TradingView Pine Script to MT5/MT4 conversion (bar-by-bar matching, with tester report)
- MT4 to MT5 migration - Version: 1.2
- Activations: 5
News Pause Guard is a utility for managing your own trades around the high-impact releases you choose in the MetaTrader 5 built-in economic calendar. For each selected release it sets a "news window" from N minutes before to M minutes after the release time. During that window it can, if you turn these options on, close positions opened inside the window, act on open positions before the window, and delete pending orders and put them back afterwards. It also publishes terminal global variables so that your other EAs can pause themselves.
This is a trade-management tool. It does not trade the news: it never opens a position or places a new order on a real or demo account, it gives no buy or sell signals, and it is not a trading strategy. It cannot prevent losses, slippage or gaps around a release. Whether and how you trade remains your decision.
With the default settings it changes nothing in your account: it only shows the panel and publishes the global variables. Every action that closes, modifies or deletes is OFF until you turn it on.
Features
- Events from the MT5 built-in calendar: currencies (automatic from the chart symbol and the positions and orders in scope, a manual list, or both), importance (high only, or medium and high), and keywords to include or skip.
- News window: starts N minutes before and ends M minutes after the release (default 15 / 15). Overlapping windows of the same currency are joined.
- Optional actions (all OFF by default):
- Close positions opened inside the window (by hand or by any EA in scope).
- Before the window, for open positions: close all, close only those in profit, or move the stop loss to break-even (+ X pips). Can start X minutes before the window.
- Delete pending orders during the window, and optionally restore them after the window.
- Scope: symbols that use the event currency, only the chart symbol, or all symbols; an optional symbol list; all trades, manual trades only (magic 0), listed magic numbers, or all except listed magic numbers.
- Global variables for your own EAs (names below).
- Panel: next matching release, its window and a countdown, upcoming events, the active settings, the last action, and the reason when the EA cannot act (for example Algo Trading is off). English or Japanese (automatic from the terminal language); times in server or computer time.
- Optional popup alerts and push notifications when a window starts or positions are closed.
Main Inputs
- News events: currency mode, manual currencies, importance, include / skip keywords, minutes before, minutes after, look-ahead hours (default 48).
- Actions in the news window: close new positions, before-window action, lead minutes, break-even offset, delete pending orders, restore pending orders.
- Which positions and orders: symbol scope, symbol list, trade (magic number) filter, magic list.
- Signal for other EAs: on / off, name prefix (default "NewsGuard").
- Alerts, Panel (language, time display, number of events 0-10, corner, offsets, font size), Orders (max slippage for closing, pip size), Strategy Tester demo, journal.
- 34 inputs in 8 groups.
How It Works
- The calendar is read for each watched currency and refreshed every few minutes. Events without an exact time (all-day or tentative) are not used. Times follow the broker's server time.
- Importance is the rating of the MT5 calendar. It can differ from other calendars.
- Keywords are matched against the event name in the terminal language and against the calendar's English event code (for example "nonfarm payrolls"). Enter English keywords if your terminal uses another language.
- "Opened inside the window" means the position's open time is at or after the window start.
- "Close only those in profit" decides once per window. Positions not in profit are left as they are.
- Break-even moves the stop loss only when the price is far enough from the entry (profit and the broker's stop level). Otherwise the position is left as it is and the panel says so.
- Restore: only pending orders placed before the window are restored, with the same type, price, SL, TP and expiry. A restored order gets a new ticket. It is not restored if it has expired, the price has already passed it, or the broker rejects it, and it is not placed twice if the same order already exists.
- Global variables (terminal, updated every second):
- NewsGuard.<CURRENCY> (for example NewsGuard.USD) and NewsGuard.ANY: the window end time (server time, seconds) while a window is active, otherwise 0.
- NewsGuard.NEXT: the start of the next window. NewsGuard.HB: the last update time (shows that the EA is running).
- In your EA: pause while GlobalVariableGet("NewsGuard.ANY") > TimeTradeServer().
Notes and Limits
- Not a guarantee. Orders are sent at the times of the calendar. Fast markets, spreads, slippage, requotes, rejected orders, a closed market or a lost connection can give worse prices or leave an order not done. A release that comes earlier or later than the calendar time, or a change in the calendar, is followed only after the next refresh.
- The EA works only while MetaTrader 5 is running, connected and Algo Trading is ON (toolbar button) and allowed in the EA settings.
- "Close positions opened inside the window" also closes positions you open by hand inside the window, if they are in scope. Use the magic number filter if you want to keep manual trades.
- On a netting account, volume added to an existing position is not a new position, so it is not closed by this option.
- The EA cannot stop another EA from sending orders. If another EA keeps opening trades inside the window, each one is closed and each one costs spread and commission. Use the global variables to make your own EAs wait.
- Several charts can run the EA. Restore records are shared, and if the chart that deleted the orders is closed, another chart with restore turned on takes over after about a minute. The restored orders are placed once.
- Panel size: about 390 pixels wide and 220 to 260 pixels high with 3 upcoming events at 100% screen scaling (font 9); larger with a bigger font, more events or higher screen scaling. It has a collapse button. On a chart that is lower than the panel, a bottom-corner panel is moved up to the top edge.
- Currencies of a symbol come from its base and profit currency. Gold and most CFDs use their quote currency (often USD). Symbols without a known currency use USD. Use the manual list if you want other currencies.
- Strategy Tester: the calendar is not available there, so the EA runs a demonstration with simulated events (named "Demo event (tester)") and small demo positions and pending orders on the chart symbol, to show the closing, break-even and pending-order functions. The tester report shows only this demonstration and is not a trading result (the demonstration stops opening trades after a small loss). With very small deposits (for example 10 USD) there may be no demo trades, because even the minimum lot needs more margin. On gold and indices in "Open prices only" mode on D1 / W1 there may also be no demo trades. The demonstration never runs on a real or demo account.
Compatibility and Support
- MetaTrader 5 only. Attach it to one chart. With the default scope it handles the positions and orders of every symbol that uses a watched currency, not only the chart symbol.
- No DLLs and no outside server. The calendar data comes from the MT5 terminal.
- Try all settings on a demo account first.
- Support through MQL5 messages, reply within 3 business days: installation, settings and bug reports. Questions about which releases to trade, market views or trade decisions cannot be answered.
- No result of your trading is promised or implied.
