Functions

Converted TradingView code (not for writing by hand)

7 names in this group.
Each comes with its signature and an example.

pine.run

What code from the Pine Script® converter uses: calls body once per bar (oldest first), then draws what it recorded (plots, alerts, strategy signals). Write new code with the series functions instead

signature
run(body: ($: PineBar, i: number) => void, settings?: { strategy?: Record<string, unknown>; maxLabels?: number; maxLines?: number; maxBoxes?: number }): void

pine.tf

A Pine timeframe string ('D', '240') as a Funnest interval

signature
tf(pineTimeframe: string): Timeframe | undefined

pine.starts

Each bar’s period start time (from date.isNew)

signature
starts(isNew: Bool): Series

pine.period

A Funnest interval as Pine writes it ('1D' → 'D')

signature
period(interval: string): string

pine.cnew

Pine’s color.new: transparency 0–100; no color (NaN) gives NaN

signature
cnew(c: Color | number, transparency?: number): Color | number

pine.crgb

Pine’s color.rgb (transparency 0–100)

signature
crgb(r: number, g: number, b: number, transparency?: number): Color | number

pine.gradient

Pine’s color.from_gradient

signature
gradient(value: number, bottom: number, top: number, bottomColor: Color, topColor: Color): Color | number

npm · GitHub