Watch how to download trading robots for free
Find us on Telegram!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Experts

Economic News Window Flag for Pausing Expert Advisors - expert for MetaTrader 5

Kenichiro Sakamoto
Kenichiro Sakamoto
5 (2)
I'm Kenichiro Sakamoto, the developer behind FXEA365 — a studio building transparent, rule-based Expert Advisors for MetaTrader 5.
Views:
40
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

This Expert Advisor does not trade. It reads the economic calendar of the terminal every 30 seconds and looks for events of the selected importance for the watched currencies. From a set number of minutes before an event until a set number of minutes after it, the terminal global variable NEWS_PAUSE is set to 1; at other times it is 0.

Any other Expert Advisor in the same terminal can read the flag with GlobalVariableGet and skip new entries while it is 1. The chart comment shows the state of the flag, the active event and the next matching event with the time left until it. A change of the state is also written to the Experts log.

Fig. 1. The utility on a EURUSD H1 chart with the next event shown

Input parameters

  • InpMinImportance - minimum importance of the events: 1 low, 2 moderate, 3 high.
  • InpCurrencies - comma separated list of currencies whose events are watched, for example USD,EUR,GBP,JPY.
  • InpMinutesBefore - the window starts this many minutes before the event time.
  • InpMinutesAfter - the window ends this many minutes after the event time.
  • InpFlagName - name of the terminal global variable that holds the flag.
  • InpLookAheadHrs - number of hours searched for the next event shown on the chart.

Notes

A simple check in another Expert Advisor is: if(GlobalVariableCheck("NEWS_PAUSE") && GlobalVariableGet("NEWS_PAUSE")==1.0) return; placed before the entry code. The flag is reset to 0 when the utility is removed from the chart.

Event names are shown by their calendar code, so the text does not depend on the terminal language. The economic calendar is not available in the Strategy Tester; in the tester the utility only shows a message and keeps the flag at 0.

Trade List Report — a colorful PDF of your trades, written in pure MQL5 Trade List Report — a colorful PDF of your trades, written in pure MQL5

Prints a colorful, print-ready PDF report of your last N trades: KPI cards, a win-rate donut, a zebra table with BUY/SELL pills and diverging profit bars. Pure MQL5 — no DLL, no external converter. Saved to `MQL5\Files`.

Psychological Level Reaction Tracker Psychological Level Reaction Tracker

Free MQL5 indicator that plots 00, 25, 50 and 75 psychological price levels and tracks historical touches, rejections, breakouts and sweeps with dashboard statistics and alerts.

Spread Spike Histogram with Moving Average Spread Spike Histogram with Moving Average

Separate window indicator that draws the spread of every bar as a histogram with its moving average and colors the bars where the spread is far above normal or above a fixed ceiling.

Missing Stop Loss and Take Profit Setter Missing Stop Loss and Take Profit Setter

Utility Expert Advisor that finds open positions without a stop loss or take profit and adds them at a fixed distance in pips from the open price. It never opens or closes trades.