Skip to content

Installation

Jesse Sanford edited this page Aug 15, 2026 · 2 revisions

Installation

The import line

//@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.

Requirements

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.

Every imported name takes the alias

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.

Budget for your own script

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.

Check it works

//@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.

Where to go next


Previous: Home  ·  Next: Quick Start

Clone this wiki locally