News Time Marker

News Time Marker is a free indicator by DinexSpace for TradingView. Marks the times of key news events on the chart, with a countdown table.

Download .zipDetailed installation guide7.5 KB · 5 files · no sign-up

What News Time Marker does

News Time Marker is a free indicator by DinexSpace for TradingView. Marks the times of key news events on the chart, with a countdown table.

News Time Marker puts the economic releases you care about directly on your chart. You see the next events, the time left, and a shaded window around each one.

When to use it

Use it to see in advance where price may spike.

Features and modes

News Time Marker has 4 documented features, listed below.

How it works

  • Pine Script cannot read a news calendar, so you enter the events yourself from your usual economic calendar: up to 6 one-off events (date and time, name, impact High / Medium / Low) and 2 daily recurring times (hour and minute in a chosen time zone, for example 08:30 New York, weekdays only by default).
  • Each one-off event gets a dashed vertical line in its impact colour, and future events are drawn too. Recurring times get a dotted line on every past day (up to 100 kept); the next occurrence is shown in the table.
  • An optional shaded window marks the minutes before and after each event (15/15 by default).
  • A countdown table lists the next events, their time in the time zone you choose, and the time left.

Parameters

News Time Marker has 11 inputs; every input and its default is listed below.

  • One-off events: on/off, date/time, name, impact.
  • Daily recurring: on/off, hour, minute, time zone, name, weekdays only, colour.
  • Display: shade minutes before/after, transparency, recurring lines kept, table rows, position, time zone for the table, alert lead time.
News Time Marker inputs – TradingView version
InputDefault
Daily recurring (on · hour · minute · time zone · name)
Recurring times on weekdays onlytrue
Recurring colourC_AQUA
Display & alerts
Shade minutes before15
after15
Shade transparency85
Recurring lines kept (each)10
Countdown tabletrue
Events in table4
Table position"Top right"
Show times in"Chart symbol"
Alert minutes before (0 = off)5

Signals

News Time Marker does not generate buy or sell signals. It is an analysis tool: you read what it plots and make your own decisions.

Alerts

Yes. News Time Marker has built-in alerts: TradingView – alert conditions for Create Alert.

  • An alert fires a set number of minutes before each event (default 5). To receive it, create an alert with the condition "Any alert() function call".

Buffers for Expert Advisors

Not applicable. News Time Marker is a TradingView script; indicator buffers for EAs are an MT5 feature.

Timeframes and markets

The shading appears on intraday charts.

Limitations

News Time Marker is an analysis tool, not a trading system. Its documented limitations are listed below.

  • Events are only as accurate as the times you type.
  • The shading appears on intraday charts. The countdown updates as new price ticks arrive, so it can pause when the market is closed.
  • The script shows times only. It does not show forecasts or actual values.

This script is an analysis aid only and is not investment advice.

Pine Script code

Paste the whole script into the Pine Editor on TradingView.

news_time_marker.pine · 215 lines
//@version=6
// DinexSpace | News Time Marker
// Marks the times of economic news you care about: a vertical line at each event, an optional shaded
// "no-trade" window before and after it, a countdown table for the next events and an alert a few
// minutes before each one. Pine scripts cannot read a news calendar, so you type the events in yourself:
// up to 6 one-off events (date + time) and 2 daily recurring times (e.g. 08:30 New York on weekdays).
// Free and open source. License: MIT. (c) 2026 DinexSpace
indicator("DinexSpace | News Time Marker", shorttitle = "DNX News", overlay = true, max_lines_count = 500, max_labels_count = 500)

// ===== Brand colours =====
C_GREEN = #00FF7F   // SpringGreen
C_AQUA  = #00FFFF   // Aqua
C_HIGH  = #FF5C7A   // high impact
C_MED   = #FFB000   // medium impact
C_LOW   = #9AA0A6   // low impact

// ===== Inputs: one-off events =====
GRP_E = "One-off events (on · date/time · name · impact)"
e1On = input.bool(false, "", inline = "e1", group = GRP_E)
e1T  = input.time(timestamp("2026-10-16T12:30:00+0000"), "", inline = "e1", group = GRP_E)
e1N  = input.string("US CPI", "", inline = "e1", group = GRP_E)
e1I  = input.string("High", "", options = ["High", "Medium", "Low"], inline = "e1", group = GRP_E)
e2On = input.bool(false, "", inline = "e2", group = GRP_E)
e2T  = input.time(timestamp("2026-10-16T14:00:00+0000"), "", inline = "e2", group = GRP_E)
e2N  = input.string("Event 2", "", inline = "e2", group = GRP_E)
e2I  = input.string("Medium", "", options = ["High", "Medium", "Low"], inline = "e2", group = GRP_E)
e3On = input.bool(false, "", inline = "e3", group = GRP_E)
e3T  = input.time(timestamp("2026-10-17T12:30:00+0000"), "", inline = "e3", group = GRP_E)
e3N  = input.string("Event 3", "", inline = "e3", group = GRP_E)
e3I  = input.string("Medium", "", options = ["High", "Medium", "Low"], inline = "e3", group = GRP_E)
e4On = input.bool(false, "", inline = "e4", group = GRP_E)
e4T  = input.time(timestamp("2026-10-20T12:30:00+0000"), "", inline = "e4", group = GRP_E)
e4N  = input.string("Event 4", "", inline = "e4", group = GRP_E)
e4I  = input.string("Low", "", options = ["High", "Medium", "Low"], inline = "e4", group = GRP_E)
e5On = input.bool(false, "", inline = "e5", group = GRP_E)
e5T  = input.time(timestamp("2026-10-21T12:30:00+0000"), "", inline = "e5", group = GRP_E)
e5N  = input.string("Event 5", "", inline = "e5", group = GRP_E)
e5I  = input.string("Low", "", options = ["High", "Medium", "Low"], inline = "e5", group = GRP_E)
e6On = input.bool(false, "", inline = "e6", group = GRP_E)
e6T  = input.time(timestamp("2026-10-22T12:30:00+0000"), "", inline = "e6", group = GRP_E)
e6N  = input.string("Event 6", "", inline = "e6", group = GRP_E)
e6I  = input.string("Low", "", options = ["High", "Medium", "Low"], inline = "e6", group = GRP_E)

// ===== Inputs: daily recurring times =====
GRP_R = "Daily recurring (on · hour · minute · time zone · name)"
r1On  = input.bool(false, "", inline = "r1", group = GRP_R)
r1H   = input.int(8, "", minval = 0, maxval = 23, inline = "r1", group = GRP_R)
r1M   = input.int(30, "", minval = 0, maxval = 59, inline = "r1", group = GRP_R)
r1Z   = input.string("America/New_York", "", options = ["America/New_York", "Europe/London", "Asia/Tokyo", "Asia/Ho_Chi_Minh", "UTC"], inline = "r1", group = GRP_R)
r1N   = input.string("US data", "", inline = "r1", group = GRP_R)
r2On  = input.bool(false, "", inline = "r2", group = GRP_R)
r2H   = input.int(10, "", minval = 0, maxval = 23, inline = "r2", group = GRP_R)
r2M   = input.int(0, "", minval = 0, maxval = 59, inline = "r2", group = GRP_R)
r2Z   = input.string("America/New_York", "", options = ["America/New_York", "Europe/London", "Asia/Tokyo", "Asia/Ho_Chi_Minh", "UTC"], inline = "r2", group = GRP_R)
r2N   = input.string("US data 2", "", inline = "r2", group = GRP_R)
rWeekdays = input.bool(true, "Recurring times on weekdays only", group = GRP_R)
rColor    = input.color(C_AQUA, "Recurring colour", group = GRP_R)

// ===== Inputs: display & alerts =====
GRP_D    = "Display & alerts"
minBefore = input.int(15, "Shade minutes before", minval = 0, maxval = 240, inline = "w", group = GRP_D)
minAfter  = input.int(15, "after", minval = 0, maxval = 240, inline = "w", group = GRP_D)
shadeTr   = input.int(85, "Shade transparency", minval = 0, maxval = 100, group = GRP_D)
keepN     = input.int(10, "Recurring lines kept (each)", minval = 1, maxval = 100, group = GRP_D)
showTbl   = input.bool(true, "Countdown table", group = GRP_D)
tblRows   = input.int(4, "Events in table", minval = 1, maxval = 8, group = GRP_D)
tblPos    = input.string("Top right", "Table position", options = ["Top right", "Top left", "Bottom right", "Bottom left"], group = GRP_D)
tzShow    = input.string("Chart symbol", "Show times in", options = ["Chart symbol", "UTC", "America/New_York", "Europe/London", "Asia/Tokyo", "Asia/Ho_Chi_Minh"], group = GRP_D)
alertMin  = input.int(5, "Alert minutes before (0 = off)", minval = 0, maxval = 120, group = GRP_D, tooltip = "Create an alert with the condition \"Any alert() function call\" to receive it.")

// ===== Helpers =====
impactColor(string imp) => imp == "High" ? C_HIGH : imp == "Medium" ? C_MED : C_LOW
string dispTz = tzShow == "Chart symbol" ? syminfo.timezone : tzShow
int MS_MIN = 60000
int MS_DAY = 86400000

fmtLeft(int ms) =>
    int m = int(ms / MS_MIN)
    int d = int(m / 1440)
    int h = int((m % 1440) / 60)
    int mm = m % 60
    d > 0 ? str.format("{0}d {1}h", d, h) : h > 0 ? str.format("{0}h {1}m", h, mm) : str.format("{0}m", mm)

// Next occurrence (at or after `from`) of a daily time hh:mm in time zone tz, skipping weekends if asked.
nextDaily(int from, int hh, int mm, string tz) =>
    int out = na
    for k = 0 to 7
        int t = timestamp(tz, year(from, tz), month(from, tz), dayofmonth(from, tz) + k, hh, mm)
        int dow = dayofweek(t, tz)
        bool ok = not rWeekdays or (dow != dayofweek.saturday and dow != dayofweek.sunday)
        if ok and t >= from
            out := t
            break
    out

// The day's event time for the bar's own day (used for shading and lines on history).
dailyAt(int hh, int mm, string tz) =>
    int t = timestamp(tz, year(time, tz), month(time, tz), dayofmonth(time, tz), hh, mm)
    int dow = dayofweek(t, tz)
    not rWeekdays or (dow != dayofweek.saturday and dow != dayofweek.sunday) ? t : na

// ===== Event lists =====
var array<bool>   oOn  = array.from(e1On, e2On, e3On, e4On, e5On, e6On)
var array<int>    oT   = array.from(e1T, e2T, e3T, e4T, e5T, e6T)
var array<string> oN   = array.from(e1N, e2N, e3N, e4N, e5N, e6N)
var array<color>  oC   = array.from(impactColor(e1I), impactColor(e2I), impactColor(e3I), impactColor(e4I), impactColor(e5I), impactColor(e6I))
var array<bool>   oFired = array.new<bool>(6, false)

int r1T = r1On ? dailyAt(r1H, r1M, r1Z) : na
int r2T = r2On ? dailyAt(r2H, r2M, r2Z) : na

// ===== Shading of the no-trade window =====
inWin(int t) => not na(t) and time >= t - minBefore * MS_MIN and time < t + minAfter * MS_MIN
color shade = na
for i = 0 to 5
    if oOn.get(i) and na(shade) and inWin(oT.get(i))
        shade := oC.get(i)
if na(shade) and (inWin(r1T) or inWin(r2T))
    shade := rColor
bgcolor(timeframe.isintraday and not na(shade) ? color.new(shade, shadeTr) : na, title = "No-trade window")

// ===== Lines =====
float yTop = ta.highest(high, 100)

// One-off events: drawn once, also in the future (time-based x coordinates).
if barstate.islast
    var bool drawn = false
    var array<label> oLbl = array.new<label>()
    if not drawn
        for i = 0 to 5
            if oOn.get(i)
                line.new(oT.get(i), close, oT.get(i), close + syminfo.mintick, xloc = xloc.bar_time, extend = extend.both, color = oC.get(i), style = line.style_dashed, width = 2)
                oLbl.push(label.new(oT.get(i), yTop, oN.get(i), xloc = xloc.bar_time, color = color(na), textcolor = oC.get(i), style = label.style_label_lower_left, size = size.small))
        drawn := true
    for lb in oLbl
        lb.set_y(yTop)

// Recurring times: one line per day on history, plus the next upcoming one.
recurring(int tDay, string name) =>
    var array<line>  lines  = array.new<line>()
    var array<label> labels = array.new<label>()
    if not na(tDay) and time <= tDay and tDay < time_close
        lines.push(line.new(tDay, close, tDay, close + syminfo.mintick, xloc = xloc.bar_time, extend = extend.both, color = rColor, style = line.style_dotted))
        labels.push(label.new(tDay, high, name, xloc = xloc.bar_time, color = color(na), textcolor = rColor, style = label.style_label_lower_left, size = size.tiny))
        if lines.size() > keepN
            line.delete(lines.shift())
            label.delete(labels.shift())

recurring(r1T, r1N)
recurring(r2T, r2N)

// ===== Upcoming events (for the table and alerts) =====
int tNow = timenow
int r1Next = r1On ? nextDaily(tNow, r1H, r1M, r1Z) : na
int r2Next = r2On ? nextDaily(tNow, r2H, r2M, r2Z) : na

// ===== Alerts (dynamic text; use "Any alert() function call") =====
var int r1Fired = na
var int r2Fired = na
if alertMin > 0 and barstate.isrealtime
    int lead = alertMin * MS_MIN
    for i = 0 to 5
        int t = oT.get(i)
        if oOn.get(i) and not oFired.get(i) and tNow >= t - lead and tNow < t
            alert(oN.get(i) + " in " + fmtLeft(t - tNow) + " on " + syminfo.ticker, alert.freq_once_per_bar)
            oFired.set(i, true)
    if not na(r1Next) and r1Fired != r1Next and tNow >= r1Next - lead
        alert(r1N + " in " + fmtLeft(r1Next - tNow) + " on " + syminfo.ticker, alert.freq_once_per_bar)
        r1Fired := r1Next
    if not na(r2Next) and r2Fired != r2Next and tNow >= r2Next - lead
        alert(r2N + " in " + fmtLeft(r2Next - tNow) + " on " + syminfo.ticker, alert.freq_once_per_bar)
        r2Fired := r2Next

// ===== Countdown table =====
tPos = switch tblPos
    "Top left"     => position.top_left
    "Bottom right" => position.bottom_right
    "Bottom left"  => position.bottom_left
    => position.top_right

var table tbl = table.new(tPos, 3, 10, bgcolor = color.new(color.black, 10), border_color = color.new(color.gray, 70), border_width = 1)

if showTbl and barstate.islast
    array<int>    uT = array.new<int>()
    array<string> uN = array.new<string>()
    array<color>  uC = array.new<color>()
    for i = 0 to 5
        if oOn.get(i) and oT.get(i) > tNow
            uT.push(oT.get(i))
            uN.push(oN.get(i))
            uC.push(oC.get(i))
    if not na(r1Next)
        uT.push(r1Next)
        uN.push(r1N)
        uC.push(rColor)
    if not na(r2Next)
        uT.push(r2Next)
        uN.push(r2N)
        uC.push(rColor)
    table.clear(tbl, 0, 0, 2, 9)
    table.cell(tbl, 0, 0, "Next events", text_color = color.gray, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl, 1, 0, "Time (" + dispTz + ")", text_color = color.gray, text_size = size.small, text_halign = text.align_right)
    table.cell(tbl, 2, 0, "In", text_color = color.gray, text_size = size.small, text_halign = text.align_right)
    int n = uT.size()
    if n == 0
        table.cell(tbl, 0, 1, "No upcoming events set", text_color = C_MED, text_size = size.small, text_halign = text.align_left)
    else
        array<int> idx = uT.sort_indices(order.ascending)
        for r = 0 to math.min(n, tblRows) - 1
            int j = idx.get(r)
            int t = uT.get(j)
            table.cell(tbl, 0, r + 1, uN.get(j), text_color = uC.get(j), text_size = size.small, text_halign = text.align_left)
            table.cell(tbl, 1, r + 1, str.format_time(t, "EEE dd MMM HH:mm", dispTz), text_color = color.white, text_size = size.small, text_halign = text.align_right)
            table.cell(tbl, 2, r + 1, fmtLeft(t - tNow), text_color = t - tNow <= alertMin * MS_MIN ? C_HIGH : C_GREEN, text_size = size.small, text_halign = text.align_right)
    table.cell(tbl, 0, 9, "DinexSpace", text_color = C_GREEN, text_size = size.tiny, text_halign = text.align_left)

News Time Marker FAQ

News Time Marker is free, runs on TradingView and does not place trades.

Is News Time Marker free?

Yes. News Time Marker is free to download from this page with no sign-up, and the download includes the full source code.

Which platforms does News Time Marker run on?

News Time Marker is available for TradingView (Pine Script v6).

Does News Time Marker give buy and sell signals?

News Time Marker does not generate buy or sell signals. It is an analysis tool: you read what it plots and make your own decisions.

Does News Time Marker have alerts?

Yes. News Time Marker has built-in alerts: TradingView – alert conditions for Create Alert.

Can an EA read News Time Marker?

Not applicable. News Time Marker is a TradingView script; indicator buffers for EAs are an MT5 feature.

Which timeframes does News Time Marker work on?

The shading appears on intraday charts.

Does News Time Marker place trades?

No. It is a read-only indicator: it only reads market data and shows the result on the chart or writes it to a file. The source contains no calls that open, close or modify orders.

How do I install News Time Marker?

Download the .zip and follow the step-by-step installation guide for TradingView: https://indicators.dinexspace.com/install-guide/

Measured win rates (backtest)

Filter / stop-trading tool: no arrows yet; new arrow rules approved, in progress.

  • Costs: Real spread of an ECN-type MT5 account, no commission.
  • Data source: MT5 tick data (BNB: Binance spot).

TradingView H4/D1 bars may follow the exchange time zone of the TradingView symbol, not the MT5 server time (UTC) used for the measurement; sessions and the H4 trend may differ on the Pine version. Same signals on TradingView not checked yet.

Past test statistics are not a promise of future results.

More in this category

All Utilities indicators

Account Info Panel

Utilities · Indicator

A compact on-chart panel showing balance, equity, margin and floating P/L. Use it to keep an eye on your account without switching to the Trade tab.

FreeMT5Filter tool

Candle Timer

Utilities · Indicator

Counts down the time left until the current candle closes, with higher timeframes alongside. Use it when you are waiting for a candle close to confirm an entry.

FreeMT5TradingViewMeasured

Economic Calendar Marker

Utilities · Indicator

Marks economic news releases on the chart using MT5's built-in economic calendar. Use it to stay out of trades right before high-impact news.

FreeMT5Filter tool