News Blackout Window Shader
A vertical line at a news event's time (the common approach) marks the instant but leaves the trader to mentally work out the actual no-trade window either side of it. This indicator draws that window directly as a shaded rectangle spanning the visible price range, so the blackout period itself - not just its centre - is visible at a glance, and keeps the shading stretched to the window's height as price scrolls. Because a human glancing at a shaded chart is not the only consumer that matters, the indicator also writes its current blackout state into a GlobalVariable named NBS_Blackout_<Symbol>, set to 1.0 while inside any loaded event's window and 0.0 otherwise. Any EA or script that wants to stand aside during news can poll that one global variable rather than re-implementing its own calendar parser - the exact naming convention is documented in the source header so other tools in this catalogue, or any independent program, can rely on it. The calendar itself is a plain CSV the trader maintains or exports from a broker/spreadsheet source (there is no built-in MT4 news feed a custom indicator can read), re-read automatically whenever its file modification time changes so edits show up without reloading the indicator. Notes and limitations - Rectangle top/bottom track the visible price range at each refresh tick, not a fixed price band; a manual zoom between refreshes can briefly show a shade that does not fully span the window. - The GlobalVariable is deleted in OnDeinit, so a listener should treat a missing variable the same as "no blackout data available" rather than assuming it always means "not in blackout". - Malformed calendar rows are skipped individually rather than aborting the whole file; a header row is detected automatically by its unparsable date column. - This indicator only shades and publishes state; it never places, modifies, or blocks an order itself - enforcement is up to whatever EA chooses to read the published GlobalVariable.
Indicator · MT5 · v1.0 · Free
About News Blackout Window Shader
News Blackout Window Shader is an indicator for MetaTrader 5. It has 7 settings, such as File name, Minutes before and Minutes after. MQL source code included.
Files in the download: NewsBlackoutShader.ex5, NewsBlackoutShader.mq5, NewsBlackoutShader.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| File name | NewsBlackoutShader.csv | File in MQL5\Files\ (Date Time,Title,Impact) |
| Minutes before | 15 | Blackout window minutes before each event |
| Minutes after | 15 | Blackout window minutes after each event |
| Impact filter | Only shade rows whose Impact matches (blank = shade all rows) | |
| Refresh seconds | 30 | Seconds between file re-read checks |
| Shade color | clrOrangeRed | Rectangle fill colour |
| Shade alpha | 40 | Shade transparency 0(solid)-100(invisible) - approximated via a light tint |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: News Trading · MT5 Indicator · MQL5 Source Code