-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
//@version=6
indicator("My indicator")
import The_Peaceful_Lizard/std_time/1 as t
The alias is yours to choose. Every example in this wiki uses t, and short is
worth something here because you will type it constantly.
Pine v6 only. The library uses enums, user-defined types and methods, none of which exist before v6.
Works from any script kind. An indicator, a strategy or another
library can all import it.
This catches everyone once, and the error message does not mention imports:
t.DateTime d = t.new_datetime(2025, 6, 15) // correct
DateTime d = t.new_datetime(2025, 6, 15) // "{typeKeyword}" is not a valid type keyword
Types, enums and enum members all take it: t.DateTime, t.Session,
t.Exchange.NYSE, t.Overflow.REJECT, t.Weekday.FRIDAY.
The signatures on the reference pages are shown as the library declares
them, where DateTime is unqualified and correct. Copying a signature into your
own script is the usual way to hit this.
The library compiles at roughly 92,000 tokens against TradingView's 100,256 publish cap, which leaves about 8,000 for the script importing it. That is comfortable for logic and tight for large string literals of your own.
Two things worth knowing before you go hunting for a phantom bug:
- The server-side syntax check does not enforce the token cap. A script can check clean and still fail to add to the chart.
- String data costs two compiled tokens per character, so your own constant tables are the first place to look if you run out.
Performance and Limits has the detail.
//@version=6
indicator("std_time smoke test")
import The_Peaceful_Lizard/std_time/1 as t
t.DateTime d = t.unix_to_date_zone(time, t.Zone.NEW_YORK)
plot(d.is_trading_day(t.Exchange.NYSE) ? 1 : 0)
On a US equity chart that plots 1 on trading days and 0 on holidays. If it compiles and plots, the import resolved and the calendar is answering.
- New to the model: Core Concepts, then the numbered run in the sidebar.
- Coming from Pine's built-ins: Migrating from Pine Built-ins.
- Looking for a specific function: API Index.
Previous: Home · Next: Quick Start
std_time v1 · API Index · Task Index · Scope and Limitations · Verification
Calendar data current to the horizons on Versioning and Data Currency. Shanghai, Bombay and Singapore answer exactly through 2026.
MPL-2.0 · Copyright (c) 2026 Jesse Sanford · published on TradingView as The_Peaceful_Lizard
Start here
The model
- Core Concepts
- Civil and Exact Arithmetic
- Value Semantics
- Error Model
- Time Zones
- Exchange Calendars
- Trading Days and Day Counts
- Expiries
- Sessions
- Formatting and Parsing
- Choosing the Right Tool
- Pitfalls
Recipes
Reference
- API Index · Task Index
- DateTime
- Session
- Zone
- Exchange
- Period · Interval
- Weekday · Enums
- Free functions
- Glossary
The fine print