// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // (c) FXMacroData //@version=6 // FXMacroData Release Markers (standalone) // Draws the scheduled tier-1 macro releases on the chart, shades a blackout window around // each one and offers two alert conditions. The release schedule is embedded below, so this // file needs no library import and works on any account when pasted into the Pine Editor. // Schedule generated 2026-10-14T04:17:03Z. 187 scheduled tier-1 releases, 120-day horizon. // Covers 2026-10-15T00:30:00Z to 2027-02-09T03:30:00Z. Coverage: AUD 19, CAD 39, CHF 11, EUR 18, GBP 26, JPY 23, NZD 14, USD 37. // Every timestamp is the publisher's own scheduled release instant (UNIX milliseconds, UTC). // Releases whose exact time has not been announced are not included. Nothing is estimated. // A fresh copy with the next schedule is published monthly. indicator("FXMacroData Release Markers", overlay = true, max_lines_count = 500, max_labels_count = 500) // Inputs string currenciesInput = input.string("USD,EUR,GBP,JPY", "Currencies (comma-separated, empty = all)") int minsBefore = input.int(15, "Minutes before release", minval = 0, maxval = 1440) int minsAfter = input.int(15, "Minutes after release", minval = 0, maxval = 1440) bool showLabels = input.bool(true, "Show labels") bool showBlackout = input.bool(true, "Shade blackout window") bool showPanel = input.bool(true, "Show next-release panel") color markerColor = input.color(color.new(color.orange, 0), "Marker colour") color blackoutColor = input.color(color.new(color.orange, 85), "Blackout shade") // Exported library functions cannot read arrays declared at script scope (only const // globals are allowed), so the schedule lives inside these helpers. Each holds a // function-local var array that is filled once per call site and returned by reference. // Callers must not mutate the returned arrays; the *s() accessors return copies. _times() => var int[] a = array.new() if array.size(a) == 0 array.concat(a, array.from(1792024200000, 1792024200000, 1792141200000, 1792141200000, 1792359900000, 1792396800000, 1792413000000, 1792413000000, 1792413000000, 1792413000000, 1792476000000, 1792476000000, 1792476000000, 1792540200000, 1792562400000, 1792562400000, 1792619100000, 1792711800000, 1792711800000, 1792711800000, 1792735200000, 1792758600000, 1793005200000, 1793147400000, 1793147400000, 1793149200000, 1793195100000, 1793210400000, 1793277000000, 1793277000000, 1793277000000, 1793279700000, 1793316600000, 1793354400000, 1793363400000, 1793676600000, 1793691000000, 1793691000000, 1793742300000, 1793742300000, 1793786400000, 1793786400000, 1793799000000, 1793880000000, 1793959200000, 1793971800000, 1793971800000, 1793971800000, 1793971800000, 1793971800000, 1793971800000, 1794317400000, 1794317400000, 1794466800000, 1794468600000, 1794786600000, 1794835800000, 1794835800000, 1794835800000, 1794835800000, 1794898800000, 1794898800000, 1794898800000, 1794959400000, 1794961800000, 1794985200000, 1794985200000, 1794996000000, 1794996000000, 1795038300000, 1795048200000, 1795048200000, 1795131000000, 1795131000000, 1795158000000, 1795181400000, 1795563000000, 1795566600000, 1795613400000, 1795613400000, 1795613400000, 1796025600000, 1796045400000, 1796081400000, 1796119200000, 1796119200000, 1796171400000, 1796196600000, 1796196600000, 1796205600000, 1796378400000, 1796391000000, 1796391000000, 1796391000000, 1796391000000, 1796391000000, 1796391000000, 1796637600000, 1796687400000, 1796700600000)) array.concat(a, array.from(1796736600000, 1796778000000, 1796827500000, 1796842800000, 1796860200000, 1796891400000, 1796909400000, 1796909400000, 1797255000000, 1797255000000, 1797255000000, 1797255000000, 1797318000000, 1797318000000, 1797318000000, 1797371100000, 1797378600000, 1797404400000, 1797404400000, 1797457500000, 1797467400000, 1797467400000, 1797501600000, 1797501600000, 1797508800000, 1797513300000, 1797543900000, 1797550200000, 1797550200000, 1797577200000, 1797600600000, 1797922800000, 1797982200000, 1798032600000, 1798032600000, 1798032600000, 1798032600000, 1798155000000, 1799134200000, 1799134200000, 1799195400000, 1799242200000, 1799415000000, 1799415000000, 1799415000000, 1799415000000, 1799415000000, 1799415000000, 1799847000000, 1799847000000, 1800019800000, 1800279000000, 1800279000000, 1800279000000, 1800279000000, 1800342000000, 1800342000000, 1800342000000, 1800489000000, 1800491400000, 1800491400000, 1800574200000, 1800574200000, 1800574200000, 1800624600000, 1800999900000, 1801009800000, 1801009800000, 1801061100000, 1801143000000, 1801143000000, 1801143000000, 1801172700000, 1801179000000, 1801229400000, 1801604700000, 1801604700000, 1801742400000, 1801746900000, 1801747800000, 1801834200000, 1801834200000, 1801834200000, 1801834200000, 1801834200000, 1801834200000, 1802143800000)) a _ccys() => var string[] a = array.new() if array.size(a) == 0 array.concat(a, array.from("AUD", "AUD", "EUR", "EUR", "NZD", "CHF", "CAD", "CAD", "CAD", "CAD", "GBP", "GBP", "GBP", "JPY", "GBP", "GBP", "NZD", "JPY", "JPY", "JPY", "GBP", "CAD", "CHF", "AUD", "AUD", "NZD", "CAD", "USD", "USD", "USD", "USD", "EUR", "JPY", "EUR", "CAD", "AUD", "CHF", "CHF", "NZD", "NZD", "EUR", "EUR", "CAD", "GBP", "EUR", "CAD", "CAD", "USD", "USD", "USD", "USD", "USD", "USD", "GBP", "CHF", "JPY", "CAD", "CAD", "CAD", "CAD", "GBP", "GBP", "GBP", "JPY", "AUD", "GBP", "GBP", "EUR", "EUR", "NZD", "AUD", "AUD", "JPY", "JPY", "GBP", "CAD", "JPY", "AUD", "USD", "USD", "USD", "CHF", "CAD", "JPY", "EUR", "EUR", "AUD", "CHF", "CHF", "EUR", "EUR", "CAD", "CAD", "USD", "USD", "USD", "USD", "EUR", "JPY", "AUD")) array.concat(a, array.from("CAD", "NZD", "CAD", "USD", "JPY", "CHF", "USD", "USD", "CAD", "CAD", "CAD", "CAD", "GBP", "GBP", "GBP", "NZD", "JPY", "GBP", "GBP", "NZD", "AUD", "AUD", "EUR", "EUR", "GBP", "EUR", "NZD", "JPY", "JPY", "GBP", "CAD", "GBP", "JPY", "CAD", "USD", "USD", "USD", "JPY", "CHF", "CHF", "AUD", "CAD", "CAD", "CAD", "USD", "USD", "USD", "USD", "USD", "USD", "USD", "CAD", "CAD", "CAD", "CAD", "GBP", "GBP", "GBP", "JPY", "AUD", "AUD", "JPY", "JPY", "JPY", "CAD", "NZD", "AUD", "AUD", "CAD", "USD", "USD", "USD", "NZD", "JPY", "CAD", "NZD", "NZD", "GBP", "EUR", "CAD", "CAD", "CAD", "USD", "USD", "USD", "USD", "AUD")) a _rels() => var string[] a = array.new() if array.size(a) == 0 array.concat(a, array.from("employment", "unemployment", "core_inflation", "inflation", "dairy_exports", "sight_deposits", "core_inflation", "core_inflation_median", "core_inflation_trim", "inflation", "employment", "unemployment", "wages", "trade_balance", "core_inflation", "inflation", "inflation", "core_inflation", "inflation", "wages", "retail_sales", "retail_sales", "sight_deposits", "inflation", "trimmed_mean_inflation", "policy_rate", "policy_rate", "policy_rate", "core_pce", "gdp", "pce", "policy_rate", "unemployment", "unemployment", "gdp", "policy_rate", "core_inflation", "inflation", "employment", "unemployment", "core_inflation", "inflation", "trade_balance", "policy_rate", "retail_sales", "employment", "unemployment", "employment", "non_farm_payrolls", "non_farm_payrolls_change", "unemployment", "core_inflation", "inflation", "gdp", "unemployment", "gdp", "core_inflation", "core_inflation_median", "core_inflation_trim", "inflation", "employment", "unemployment", "wages", "trade_balance", "wage_price_index", "core_inflation", "inflation", "core_inflation", "inflation", "dairy_exports", "employment", "unemployment", "core_inflation", "inflation", "retail_sales", "retail_sales", "wages", "inflation", "core_pce", "gdp", "pce", "gdp", "gdp", "unemployment", "core_inflation", "inflation", "gdp", "core_inflation", "inflation", "unemployment", "retail_sales", "employment", "unemployment", "employment", "non_farm_payrolls", "non_farm_payrolls_change", "unemployment", "gdp", "gdp", "policy_rate")) array.concat(a, array.from("trade_balance", "policy_rate", "policy_rate", "policy_rate", "business_confidence", "policy_rate", "core_inflation", "inflation", "core_inflation", "core_inflation_median", "core_inflation_trim", "inflation", "employment", "unemployment", "wages", "trade_balance", "trade_balance", "core_inflation", "inflation", "gdp", "employment", "unemployment", "core_inflation", "inflation", "policy_rate", "policy_rate", "dairy_exports", "core_inflation", "inflation", "retail_sales", "retail_sales", "gdp", "wages", "gdp", "core_pce", "gdp", "pce", "unemployment", "core_inflation", "inflation", "inflation", "trade_balance", "employment", "unemployment", "employment", "non_farm_payrolls", "non_farm_payrolls_change", "unemployment", "core_inflation", "inflation", "retail_sales", "core_inflation", "core_inflation_median", "core_inflation_trim", "inflation", "employment", "unemployment", "wages", "trade_balance", "employment", "unemployment", "core_inflation", "inflation", "wages", "retail_sales", "inflation", "inflation", "trimmed_mean_inflation", "policy_rate", "core_pce", "gdp", "pce", "dairy_exports", "unemployment", "gdp", "employment", "unemployment", "policy_rate", "policy_rate", "trade_balance", "employment", "unemployment", "employment", "non_farm_payrolls", "non_farm_payrolls_change", "unemployment", "policy_rate")) a _labels() => var string[] a = array.new() if array.size(a) == 0 array.concat(a, array.from("Employment", "Unemployment", "Core CPI", "CPI", "Dairy exports", "Sight deposits", "Core CPI", "CPI-median", "CPI-trim", "CPI", "Employment", "Unemployment", "Wages", "Trade balance", "Core CPI", "CPI", "CPI", "Core CPI", "CPI", "Wages", "Retail sales", "Retail sales", "Sight deposits", "CPI", "Trimmed mean CPI", "Rate decision", "Rate decision", "Rate decision", "Core PCE", "GDP", "PCE", "Rate decision", "Unemployment", "Unemployment", "GDP", "Rate decision", "Core CPI", "CPI", "Employment", "Unemployment", "Core CPI", "CPI", "Trade balance", "Rate decision", "Retail sales", "Employment", "Unemployment", "Employment", "NFP", "NFP change", "Unemployment", "Core CPI", "CPI", "GDP", "Unemployment", "GDP", "Core CPI", "CPI-median", "CPI-trim", "CPI", "Employment", "Unemployment", "Wages", "Trade balance", "Wage price index", "Core CPI", "CPI", "Core CPI", "CPI", "Dairy exports", "Employment", "Unemployment", "Core CPI", "CPI", "Retail sales", "Retail sales", "Wages", "CPI", "Core PCE", "GDP", "PCE", "GDP", "GDP", "Unemployment", "Core CPI", "CPI", "GDP", "Core CPI", "CPI", "Unemployment", "Retail sales", "Employment", "Unemployment", "Employment", "NFP", "NFP change", "Unemployment", "GDP", "GDP", "Rate decision")) array.concat(a, array.from("Trade balance", "Rate decision", "Rate decision", "Rate decision", "Business confidence", "Rate decision", "Core CPI", "CPI", "Core CPI", "CPI-median", "CPI-trim", "CPI", "Employment", "Unemployment", "Wages", "Trade balance", "Trade balance", "Core CPI", "CPI", "GDP", "Employment", "Unemployment", "Core CPI", "CPI", "Rate decision", "Rate decision", "Dairy exports", "Core CPI", "CPI", "Retail sales", "Retail sales", "GDP", "Wages", "GDP", "Core PCE", "GDP", "PCE", "Unemployment", "Core CPI", "CPI", "CPI", "Trade balance", "Employment", "Unemployment", "Employment", "NFP", "NFP change", "Unemployment", "Core CPI", "CPI", "Retail sales", "Core CPI", "CPI-median", "CPI-trim", "CPI", "Employment", "Unemployment", "Wages", "Trade balance", "Employment", "Unemployment", "Core CPI", "CPI", "Wages", "Retail sales", "CPI", "CPI", "Trimmed mean CPI", "Rate decision", "Core PCE", "GDP", "PCE", "Dairy exports", "Unemployment", "GDP", "Employment", "Unemployment", "Rate decision", "Rate decision", "Trade balance", "Employment", "Unemployment", "Employment", "NFP", "NFP change", "Unemployment", "Rate decision")) a _inRange(int i) => i >= 0 and i < array.size(_times()) _matches(string[] codes, string code) => array.size(codes) == 0 or array.includes(codes, code) // Number of embedded events. count() => array.size(_times()) // Scheduled release instant of event `i` in UNIX milliseconds (UTC). eventTime(int i) => _inRange(i) ? array.get(_times(), i) : int(na) // Upper-case ISO currency code of event `i`. eventCurrency(int i) => _inRange(i) ? array.get(_ccys(), i) : string(na) // Release slug of event `i` (for example `policy_rate`, `inflation`). eventRelease(int i) => _inRange(i) ? array.get(_rels(), i) : string(na) // Short chart label of event `i` (for example `Rate decision`, `CPI`). eventLabel(int i) => _inRange(i) ? array.get(_labels(), i) : string(na) // Copy of every event time, ascending, UNIX milliseconds (UTC). eventTimes() => array.copy(_times()) // Copy of every event currency code, aligned with `eventTimes()`. eventCurrencies() => array.copy(_ccys()) // Copy of every event release slug, aligned with `eventTimes()`. eventReleases() => array.copy(_rels()) // Copy of every event label, aligned with `eventTimes()`. eventLabels() => array.copy(_labels()) // When this schedule was generated, UNIX milliseconds (UTC). generatedAt() => 1791951423862 // When this schedule was generated, as ISO 8601 text (UTC). generatedAtText() => "2026-10-14T04:17:03Z" // Parse a comma-separated currency list into upper-case codes. parseCurrencies(string currencies) => string[] out = array.new() if str.length(str.trim(currencies)) > 0 for part in str.split(str.upper(currencies), ",") string code = str.trim(part) if str.length(code) > 0 array.push(out, code) out // Whether `code` is selected by a parsed currency filter. currencyMatches(string[] codes, string code) => _matches(codes, code) // Whether `nowMs` falls inside any event's blackout window. isInBlackout(int nowMs, int minsBefore, int minsAfter, string currencies) => string[] codes = parseCurrencies(currencies) string[] ccys = _ccys() bool hit = false for [i, evt] in _times() if _matches(codes, array.get(ccys, i)) and nowMs >= evt - minsBefore * 60000 and nowMs <= evt + minsAfter * 60000 hit := true break hit // Index of the first event at or after `nowMs` for the selected currencies. nextEventIndex(int nowMs, string currencies) => string[] codes = parseCurrencies(currencies) string[] ccys = _ccys() int found = -1 for [i, evt] in _times() if evt >= nowMs and _matches(codes, array.get(ccys, i)) found := i break found // Schedule, read once. var int[] evTimes = eventTimes() var string[] evCcys = eventCurrencies() var string[] evLabels = eventLabels() var string[] codes = parseCurrencies(currenciesInput) int beforeMs = minsBefore * 60000 int afterMs = minsAfter * 60000 int tfMs = timeframe.in_seconds() * 1000 int barOpen = time int barClose = na(time_close) ? time + tfMs : time_close // Historical placement: an event belongs to the bar whose [open, close) span contains it. // A bar is in blackout when its span overlaps any selected event's window. string stacked = "" bool eventHere = false bool barInBlackout = false for [i, evt] in evTimes if currencyMatches(codes, array.get(evCcys, i)) if evt >= barOpen and evt < barClose eventHere := true string txt = array.get(evCcys, i) + " " + array.get(evLabels, i) stacked := stacked == "" ? txt : stacked + "\n" + txt if barClose > evt - beforeMs and barOpen < evt + afterMs barInBlackout := true if eventHere line.new(barOpen, low, barOpen, high, xloc = xloc.bar_time, extend = extend.both, color = markerColor, style = line.style_dashed, width = 1) if showLabels label.new(barOpen, high, stacked, xloc = xloc.bar_time, style = label.style_label_down, color = markerColor, textcolor = color.white, size = size.small) bgcolor(showBlackout and barInBlackout ? blackoutColor : na) // Future placement: on the last bar, draw every selected event that lies beyond the bar's close. // Drawings may not be placed further than about 500 bars ahead, so the reach is capped. if barstate.islast int reachMs = barClose + 490 * tfMs for [i, evt] in evTimes if evt >= barClose and evt < reachMs and currencyMatches(codes, array.get(evCcys, i)) line.new(evt, low, evt, high, xloc = xloc.bar_time, extend = extend.both, color = markerColor, style = line.style_dotted, width = 1) if showLabels label.new(evt, high, array.get(evCcys, i) + " " + array.get(evLabels, i), xloc = xloc.bar_time, style = label.style_label_down, color = markerColor, textcolor = color.white, size = size.small) // Live conditions use the wall clock, not bar time, so alerts fire between bars as well. int nextIdx = nextEventIndex(timenow, currenciesInput) int nextTime = eventTime(nextIdx) bool upcoming = nextIdx >= 0 and nextTime - timenow <= beforeMs and nextTime >= timenow bool blackoutNow = isInBlackout(timenow, minsBefore, minsAfter, currenciesInput) alertcondition(upcoming, title = "Tier-1 release within N minutes", message = "A scheduled tier-1 release is due within the configured window.") alertcondition(blackoutNow, title = "Blackout active", message = "A scheduled tier-1 release blackout window is active.") // Next-release panel. var table panel = table.new(position.top_right, 1, 3, border_width = 1) if barstate.islast and showPanel string nextText = nextIdx >= 0 ? eventCurrency(nextIdx) + " " + eventLabel(nextIdx) : "No release in schedule" string whenText = nextIdx >= 0 ? str.format_time(nextTime, "yyyy-MM-dd HH:mm", "UTC") + " UTC" : "" string stateText = blackoutNow ? "Blackout active" : upcoming ? "Release imminent" : "Schedule to " + str.format_time(array.get(evTimes, array.size(evTimes) - 1), "yyyy-MM-dd", "UTC") table.cell(panel, 0, 0, nextText, text_color = color.white, bgcolor = color.new(color.black, 20), text_size = size.small) table.cell(panel, 0, 1, whenText, text_color = color.white, bgcolor = color.new(color.black, 20), text_size = size.small) table.cell(panel, 0, 2, stateText, text_color = color.white, bgcolor = blackoutNow ? color.new(color.red, 20) : color.new(color.black, 20), text_size = size.small)