Loading…

News Proximity Checker

MQL4 has no calendar feed of its own, so several tools in this catalogue share one documented calendar file format - a plain CSV a trader (or an export tool) maintains in the MQL4\Files\ (or MQL5\Files\ on the native MQL5 build) sandbox, giving each event's currency, name, GMT time and the minutes either side that form its ban window. This script is the read-only companion to those tools: it never touches an order, it only tells a trader, before they click Buy or Sell, whether the pair in front of them is close to news. Run it on any chart and it checks both currencies of that symbol against the loaded calendar. If a currency is currently inside an active ban window, it reports which event and how many minutes until that window clears. If not, it reports the number of minutes until the next qualifying event. A currency with nothing upcoming in the loaded file is reported plainly as such, rather than left silent. The calendar's GMT event times are converted to server time using a configurable offset, since MT4 has no built-in GMT reference and every broker's server clock sits at a different offset from GMT depending on their own daylight-saving convention. Notes and limitations - Currency-pair matching assumes a plain 6-letter symbol (base + quote); symbols that do not fit that shape are refused with a clear message. - Malformed calendar lines are skipped and counted in the Print output rather than aborting the whole load. - This is a one-shot check at the moment the script is run, not a live monitor - re-run it, or attach one of the news-blackout tools in this catalogue for continuous enforcement. - The calendar lives in the per-terminal MQL4\Files\ (or MQL5\Files\ on the native MQL5 build) sandbox, not the shared Common\Files folder.

Script · MT5 · v1.0 · Free

About News Proximity Checker

News Proximity Checker is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Symbol, Calendar file name and Min impact. MQL source code included.

Files in the download: NewsProximityChecker.ex5, NewsProximityChecker.mq5, NewsProximityChecker.txt.

Settings

SettingDefaultWhat it does
SymbolSymbol to check ("" = this chart's symbol)
Calendar file nameNewsProximityChecker_Calendar.csvCalendar file, MQL5\Files\ sandbox (see header for format)
Min impact2Only events at or above this impact (1-3) are reported
Server to gmt offset hours0Broker/server time minus GMT, hours (0 if server already reports GMT)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: News Trading · Alerts · MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria