Indicator · Pine Script v6 · On the chart

HTF Timestamp Probe

by 345-strategies

HTF Timestamp Probe is a diagnostic utility indicator that inspects how TradingView timestamps higher-timeframe bar open times.

View on GitHub

Repaints

GitHub stars5on the repository
Pine versionv6current
Lines of code66
Settings0inputs
LicenceMPL-2.0
Last update2 days ago26 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

66 lines of Pine Script v6 from diagnostics/HTF_Timestamp_Probe.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

HTF_Timestamp_Probe.pine
//@version=6
// HTF Timestamp Probe  -  throwaway diagnostic for HTF-STRADDLE-1
//
// Purpose: reveal how TradingView timestamps a higher-timeframe (calendar) bar's OPEN,
// exactly as the main indicator fetches it (request.security + lookahead_on), so the
// straddle detection can be rebuilt on fact instead of inference.
//
// HOW TO USE (near a month/quarter roll, e.g. early July 2026 on Micro Gold):
//   1. Add this to a chart. Read the table (top-right).
//   2. Do it on a 1W chart AND on a 1M chart AND a 1D chart. Screenshot each.
//
// WHAT WE'RE LOOKING FOR, per HTF row:
//   - "served open (ET)"  = the current HTF bar's open time as the indicator sees it.
//        Is the CURRENT quarter's bar stamped Jul 01 00:00 (calendar-start) or
//        Jun 30 18:00 (prior-evening session open)? That is the whole question.
//   - "srv M/Q" vs "now M/Q": if these DIFFER on a chart where the HTF is NOT actually
//        straddled (e.g. 3M row on the 1M chart), the realPeriodTime-based test would
//        ALSO misfire and needs a session-offset correction. If they MATCH there and
//        only differ on a genuine straddle (3M row on the 1W chart), the clean
//        realPeriodTime compare is correct as-is.
//   - "chart M/Q" is what the BROKEN v2.2.2 code used (the chart bar's own period) -
//        shown so the discrepancy that caused the regression is visible directly.

indicator("HTF Timestamp Probe", overlay = true)

TZ = "America/New_York"

f_q(t) => na(t) ? na : math.ceil(month(t, TZ) / 3)
f_mq(t) => na(t) ? "na" : str.tostring(month(t, TZ)) + "/Q" + str.tostring(math.ceil(month(t, TZ) / 3))
f_fmt(t) => na(t) ? "na" : str.format_time(t, "yyyy-MM-dd HH:mm", TZ)

// Served HTF bar OPEN times, fetched exactly like the main indicator (lookahead_on).
wOpen = request.security(syminfo.tickerid, "W",   time, lookahead = barmerge.lookahead_on)
mOpen = request.security(syminfo.tickerid, "M",   time, lookahead = barmerge.lookahead_on)
qOpen = request.security(syminfo.tickerid, "3M",  time, lookahead = barmerge.lookahead_on)
yOpen = request.security(syminfo.tickerid, "12M", time, lookahead = barmerge.lookahead_on)

var table tbl = table.new(position.top_right, 5, 6, bgcolor = color.new(color.black, 0), frame_color = color.gray, frame_width = 1, border_color = #333333, border_width = 1)

if barstate.islast
    nowMQ = f_mq(timenow)
    // header
    table.cell(tbl, 0, 0, "HTF",             text_color = #888888, text_size = size.small)
    table.cell(tbl, 1, 0, "served open (ET)", text_color = #888888, text_size = size.small)
    table.cell(tbl, 2, 0, "srv M/Q",         text_color = #888888, text_size = size.small)
    table.cell(tbl, 3, 0, "now M/Q",         text_color = #888888, text_size = size.small)
    table.cell(tbl, 4, 0, "chart M/Q",       text_color = #888888, text_size = size.small)
    // context row: the chart itself
    table.cell(tbl, 0, 1, "CHART " + timeframe.period, text_color = color.yellow, text_size = size.small)
    table.cell(tbl, 1, 1, f_fmt(time),  text_color = color.yellow, text_size = size.small)
    table.cell(tbl, 2, 1, f_mq(time),   text_color = color.yellow, text_size = size.small)
    table.cell(tbl, 3, 1, nowMQ,        text_color = color.yellow, text_size = size.small)
    table.cell(tbl, 4, 1, f_mq(time),   text_color = color.yellow, text_size = size.small)
    // per-HTF rows (red = served period differs from now = would trigger straddle test)
    labels = array.from("W", "M", "3M", "12M")
    opens  = array.from(wOpen, mOpen, qOpen, yOpen)
    for i = 0 to 3
        o = array.get(opens, i)
        bool diff = na(o) or f_mq(o) != nowMQ
        c = diff ? color.red : color.lime
        r = i + 2
        table.cell(tbl, 0, r, array.get(labels, i), text_color = c, text_size = size.small)
        table.cell(tbl, 1, r, f_fmt(o),             text_color = c, text_size = size.small)
        table.cell(tbl, 2, r, f_mq(o),              text_color = c, text_size = size.small)
        table.cell(tbl, 3, r, nowMQ,                text_color = c, text_size = size.small)
        table.cell(tbl, 4, r, f_mq(time),           text_color = #777777, text_size = size.small)

Overview

HTF Timestamp Probe requests open timestamps for weekly, monthly, quarterly, and yearly bars using lookahead security calls and displays the results in a table on the price chart. The table compares the served open time, served period, current time, and chart period in New York time. Designed specifically for debugging higher-timeframe straddle detection, it contains no trading signals, inputs, or execution logic.

Details

Published by

345-strategies on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Screeners & dashboards

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Topics

indicatorpine-scriptthestrattradingtradingviewprice-actionstratpine-script-librarythestrat-suite

Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Symbol Info Helper

by everget
948 stars

Symbol Info Helper is an informational utility script that displays metadata about the currently selected instrument directly on the main price chart. It gathers built-in symbol properties including ticker identifier, description, instrument type, point value,

Indicator v4 Screeners & dashboards
Updated 10 days ago · GPL-3.0 GitHub repository of Symbol Info Helper
575 stars

The indicator plots ICT displacement candles on the price chart and can switch to retracement scanning. Displacement requires a move larger than a set share of the 14-bar average high-low range, lasting at least a chosen number of bars, with optional close, pr

Indicator v6 SMC / ICT / price actionCandlestick patterns
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Displacement Candles Indicator
330 stars

This indicator monitors multiple cryptocurrency symbols for trading signals. It calculates and plots entry prices, take profit, and stop loss levels for each symbol including BTCUSDT, ETHUSDT, BNBUSDT and others. Price crossovers trigger buy, sell or close ale

Indicator v5 Support & resistanceScreeners & dashboards
Updated 2 months ago · None stated GitHub repository of Multi Alert Long/Short [Alorse]

Pricing Table

by namuan
318 stars

This indicator calculates theoretical options contract values and in-the-money probabilities using historical realized volatility across multiple standard deviations. It displays these metrics in a table overlay directly on the price chart. Users can adjust th

Indicator v4 Volatility & bandsScreeners & dashboards
Updated 2 months ago · MIT GitHub repository of Pricing Table

3938 Tracker

by Allen1212
303 stars

3938 Tracker visualizes historical buying and selling activity from ARK Invest funds directly on the main price chart. It plots labels at specific timestamps corresponding to trade dates, indicating buy or sell actions along with the count of participating ETF

Indicator v4 Screeners & dashboards
Updated 2 years ago · None stated GitHub repository of 3938 Tracker

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers