Indicator · Pine Script v5 · Own pane

M_time

by GammaExpansion

M_time is a technical diagnostic indicator designed to output and plot various temporal built-in variables, timestamp functions, timeframe metadata, and bar state flags in Pine Script.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code65
Settings0inputs
LicenceMIT
Last update3 weeks ago30 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

65 lines of Pine Script v5 from packages/golden/fixtures/indicator/v5/M_time__btcusdt_60/source.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

source.pine
//@version=5
indicator("M_time")
plot(bar_index, "bar_index")
plot(time, "time_builtin")
plot(time_close, "time_close")
plot(time_tradingday, "time_tradingday")
plot(year, "year")
plot(month, "month")
plot(dayofmonth, "dayofmonth")
plot(dayofweek, "dayofweek")
plot(hour, "hour")
plot(minute, "minute")
plot(second, "second")
plot(weekofyear, "weekofyear")
plot(hour(time, "UTC"), "hour_utc")
plot(dayofweek(time, "UTC"), "dayofweek_utc")
plot(dayofmonth(time, "UTC"), "dayofmonth_utc")
plot(hour(time, "Asia/Tokyo"), "hour_tokyo")
plot(hour(time, syminfo.timezone) - hour(time, "UTC"), "tz_offset_hours")
plot(timestamp(2024, 1, 15, 9, 30, 0), "ts_naive")
plot(timestamp("UTC", 2024, 1, 15, 9, 30), "ts_utc")
plot(timestamp("America/New_York", 2024, 1, 15, 9, 30), "ts_ny")
plot(timestamp("GMT+1", 2024, 1, 15, 9, 30), "ts_gmt1")
plot(timestamp("2024-01-15T09:30:00-05:00"), "ts_iso_offset")
plot(timestamp("2024-01-15T09:30:00"), "ts_iso_naive")
plot(timestamp("2024-01-15"), "ts_date_only")
plot(timestamp(2024, 2, 30, 0, 0), "ts_feb30")
plot(time(timeframe.period), "time_tf")
plot(time(timeframe.period, "0930-1600"), "time_session_naive")
plot(time(timeframe.period, "0930-1600", "America/New_York"), "time_session_ny")
plot(time(timeframe.period, "0000-0000:1234567", "UTC"), "time_session_utc_all")
plot(time("D"), "time_D")
plot(time_close("D"), "time_close_D")
plot(time("W"), "time_W")
plot(time("240"), "time_240")
plot(timeframe.change("D") ? 1 : 0, "tf_change_D")
plot(session.isfirstbar ? 1 : 0, "session_isfirstbar")
plot(session.islastbar ? 1 : 0, "session_islastbar")
plot(session.isfirstbar_regular ? 1 : 0, "session_isfirstbar_regular")
plot(session.islastbar_regular ? 1 : 0, "session_islastbar_regular")
plot(session.ismarket ? 1 : 0, "session_ismarket")
plot(session.ispremarket ? 1 : 0, "session_ispremarket")
plot(session.ispostmarket ? 1 : 0, "session_ispostmarket")
plot(syminfo.mintick, "syminfo_mintick")
plot(syminfo.pointvalue, "syminfo_pointvalue")
plot(syminfo.pricescale, "syminfo_pricescale")
plot(syminfo.minmove, "syminfo_minmove")
plot(str.length(syminfo.timezone), "len_syminfo_timezone")
plot(str.length(syminfo.session), "len_syminfo_session")
plot(timeframe.multiplier, "tf_multiplier")
plot(timeframe.in_seconds(), "tf_in_seconds")
plot(timeframe.isintraday ? 1 : 0, "tf_isintraday")
plot(timeframe.isdaily ? 1 : 0, "tf_isdaily")
plot(timeframe.isdwm ? 1 : 0, "tf_isdwm")
plot(str.length(timeframe.period), "len_tf_period")
plot(str.tonumber(timeframe.period), "tonumber_tf_period")
plot(last_bar_index, "last_bar_index")
plot(last_bar_time, "last_bar_time")
plot(barstate.isfirst ? 1 : 0, "isfirst")
plot(barstate.islast ? 1 : 0, "islast")
plot(barstate.isconfirmed ? 1 : 0, "isconfirmed")
plot(barstate.ishistory ? 1 : 0, "ishistory")
plot(barstate.islastconfirmedhistory ? 1 : 0, "islastconfirmedhistory")
plot(ta.change(time) / 1000, "bar_gap_seconds")
plot(str.length(str.format_time(time, "yyyy-MM-dd HH:mm", syminfo.timezone)), "len_format_time")

Overview

M_time calculates and displays values including current bar timestamps across multiple timezones, session flags, timeframe durations, symbol attributes, and bar state checks in a separate indicator pane. The script serves primarily as a fixture for verifying time calculations and environment data across chart bars.

Details

Published by

GammaExpansion on GitHub

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

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

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper
550 stars

Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa

Indicator v5 VolumeSessions & time Repaints
Updated 11 months ago · None stated GitHub repository of Range Volume Change
257 stars

Donald SPX - Options Trading is an indicator designed to assist SPX index option traders by tracking session benchmarks and multi-timeframe moving average data. It calculates a 200-period weighted moving average (WMA) and requests multi-timeframe bar data from

Indicator v5 Moving averagesScreeners & dashboards Repaints
Updated 2 months ago · None stated GitHub repository of Donald SPX - Options Trading

Bar date/time

by be-thomas
65 stars

This indicator plots each bar's opening time as a numeric series in a separate pane. It uses Pine Script's built-in time value and draws one plot, not an overlay on price. There are no inputs, so the line follows the chart's bar timestamps without filters or o

Indicator v4 Sessions & time
Updated 4 weeks ago · GPL-3.0 GitHub repository of Bar date/time
47 stars

This indicator summarizes higher-timeframe candle range statistics by time of day and shows them in a table in a separate pane. It groups candles into slots for 5-minute, 15-minute, 1-hour, 4-hour, 8-hour, or 12-hour periods over a chosen lookback in days, and

Indicator v5 Screeners & dashboardsSessions & time Repaints
Updated 2 months ago · None stated GitHub repository of HTF Candle Stats by Time of Day
34 stars

This indicator calculates a Slow Stochastic oscillator and plots tiered zone-cross signals in a separate pane. It ranks crosses from overbought and oversold zones into four tiers (EXTREME, A, B, and C) using zone depth, an excursion filter allowing one signal

Indicator v6 Oscillators & momentumSupport & resistance
Updated 2 weeks ago · MIT GitHub repository of LG9k StochSlow Zone-Cross (tiered)

More Sessions & time scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers