Skip to main content

Taji indicators and plugins vs Pine Script

Taji indicators and plugins are written for coding agents first, because that is how software is written now. Taji has no language of its own: an indicator is TypeScript, and a plugin is Rust, the language of Taji's own kernel and its 106 built-in indicators, or Python. Their compilers, type checkers and test runners are the ones every coding agent already uses, so your agent writes with the best tools there are for safety, performance and correct code. An indicator is Pine's level, a figure per bar on a chart; a plugin goes deeper than any Pine script, adding a backend, views in Taji's window and indicators of its own. Pine Script is TradingView's own language, written in its Pine Editor and run on its servers.12

TajiPine Script
LanguageTypeScript for indicators; Rust or Python for plugins: open and industry-standardPine Script v6, TradingView's own1
Written byYour coding agent, such as Claude Code, Codex or Cursor, from a promptYou, in the Pine Editor;2 an agent only through TradingView's MCP server, 10 to 500 calls a day by plan3
Checked before it runsYour agent's type checker against taji.d.ts, then the compiler, three invariants and your own tests, on every writeThe compiler3
ReadsBars, events, the tape, quotes and auction imbalance; through a plugin, the order book, option chains with greeks and any vendor or fileBars, events, financials, economic series and a volume footprint; bid, ask and the aggressor on 1-tick charts45
Speedta primitives and the built-ins are compiled Rust; your script runs in V8 on your machineLimited in execution time, memory and size on TradingView's servers16
Where it runsYour machineTradingView's servers1

Every statement about Pine cites the page of the Pine Script v6 User Manual, TradingView's blog or its help center it comes from, fetched 2026-12-03; v6 is the version TradingView updates.5

Indicator or plugin?​

Taji extends at two levels. An indicator is the level a Pine script works at; a plugin adds what no Pine script can.

Taji indicatorTaji pluginPine script
What it isOne TypeScript module on @taji/indicators (The indicator SDK)A directory: a manifest, taji-plugin.toml, and the code that serves what it declares (Plugins)One script, declared with indicator(), strategy() or library()7
LanguageTypeScriptRust or Python for its process; TypeScript for its panes, layers and indicatorsPine Script v61
What it addsPlots, fills, drawings and a table or card on a chart (Outputs)Verbs your agent calls as tools and nodes it reads; data sources, and products of its own computed from Taji's data or a vendor's; panes in Taji's window; chart layers drawn from its products; indicators of its own (Which kind do I need?)Plots, drawings and tables on a chart;6 a strategy's simulated orders in the Strategy Tester8
What it readsThe chart's bars, other bars, events and the hub's products, a plugin's included (Inputs)Every hub product its manifest grants, the order book and option chains included; as a source, a vendor through the hosts its manifest grants, or files in its own directoryIts chart's data and the request.*() functions4
Where it runsThe kernel on your machine, in V8Its own process on your machine, in an OS sandbox that reaches only the hosts its manifest grants; its panes in a sandboxed frame of Taji's windowTradingView's servers1
Who uses itYou and your agent bind it to a chart, and an alert reads its plotYour agent calls its verbs and reads its nodes; Taji's window draws its panes and layers; your indicators read its productsYou, on a TradingView chart2

Write an indicator for a figure per bar from data Taji already serves; write a plugin when the data needs a backend first, such as a book, a chain or a vendor, or when it needs a view of its own. Everything Taji does beyond its core is a plugin, the chart included.

What each can read​

Each row says whether an indicator reads the data directly or a plugin brings it, and where it comes from. "Your provider" is a linked data source or brokerage; Data coverage names which serves what. Yahoo needs no key.

DataTajiPine
Bars and volumeIndicator: bar, at 1 minute to a year; from Yahoo or your provider (Inputs)The chart's bars, 1-tick to 1,000-tick charts among them910
Other symbols and intervalsIndicator: data.bars({ symbol, interval }), up to 8 data entries (Inputs)request.security(), up to 40 unique requests a script (64 on Ultimate)4
The finer bars inside a barIndicator: .intrabars on a finer data.bars entry, the newest 200,000 (Inputs)request.security_lower_tf(); up to 100,000 intrabars on Basic to Premium, 200,000 on Ultimate46
Dividends, splits, earningsIndicator: data.events("dividends"), "splits", "earnings", each from the first bar it is knowablerequest.dividends(), request.splits(), request.earnings()4
The trade tapeIndicator: data.product("trades"), each print with its aggressor where the source states it; Yahoo streams it liveOn a 1-tick chart, a bar per tick, with aggressor_side since November 2026105
Best bid and askIndicator: data.product("quotes"), bid and ask with their sizes; Yahoo streams thembid and ask, on the 1-tick timeframe only5
Auction imbalanceIndicator: data.product("imbalance"), the imbalance a venue publishes before an open or close, from your providerNone of the request.*() functions4
The order book, level by levelPlugin: streams the hub's depth and serves rows an indicator reads, as Order flow's taji-orderflow.book; from your providerNone of the request.*() functions4
Buy and sell volumePlugin: Order flow's prints and delta, each print's side the feed's or the tick rule's; its cvd indicator sums the deltarequest.footprint(), buy and sell volume by price row, classed from intrabar price action; one call a script, Premium or Ultimate4
Off-exchange printsPlugin: Dark pool's taji-darkpool.prints and levels, the prints reported to a FINRA facility; from your providerNone of the request.*() functions4
Option chains with greeksPlugin: reads chains, each contract's IV, delta, gamma, theta, vega and rho, computed by Taji where the vendor sends none; Yahoo's delayed chainNone of the request.*() functions4
Dealer gamma exposurePlugin: GEX's levels, strikes, curve and expiries, which an indicator reads with data.product("taji-gex.levels"); from Yahoo's delayed chainNone of the request.*() functions4
Any vendor or filePlugin: a data source in Python or Rust serves bars or a product of its own (Add a data source)request.seed(), from a GitHub repository its author maintains4

An indicator also reads another indicator's plot, built-in or custom, through a source input, and the kernel computes that indicator first (Inputs). What Pine reads and an indicator does not, financial statements and economic series among them, is under Other data.

Indicators you can build in Taji and not in Pine​

  • Dealer gamma by strike. A plugin estimates dealer gamma exposure by strike from SPY's option chain, with the flip and the walls, and the chart draws it (Chart dealer gamma exposure). No Pine request.*() function reads an option chain.4
  • An order-flow heatmap. The book's resting size at every price behind the candles, trade bubbles from the tape and a cumulative delta pane (Draw an order-flow heatmap). No Pine request.*() function reads a book;4 Pine's nearest reads are request.footprint(), one call a script on Premium or Ultimate, and the aggressor of each tick on a 1-tick chart.465
  • An indicator with its own test. A write carries a test beside the source, and the kernel runs it with the compiler and three invariants, storing nothing that fails (Your first indicator). Pine checks a script with its compiler; its debugging tools are logs and a profiler.31112
  • An indicator your agent iterates on all day. Your agent writes over MCP with no daily count; TradingView's MCP server counts each call against 10 to 500 a day by plan.3
  • Any computation in Rust. A feature plugin computes in Rust and serves a product; an indicator reads it with data.product(...) and draws it (Build a feature plugin). A Pine script is written in Pine and runs on TradingView's servers.1

The whole order book​

Every level of the book, every second, behind the candles.

A plugin streams the hub's depth, the book a provider serves level by level, and serves its own rows from it. Order flow serves five: a heatmap column of each second's peak resting size at every price, the book at each second's close, the best bid and ask, the prints and the delta. Its four chart layers draw them in Taji's window, and no Pine request.*() function reads a book.4 Registering the book product, in plugins/taji-orderflow/src/main.rs:

p.product::<Book>().live(|cx, sub| {
follow(
cx,
sub,
Books::of(sub.item()).every(SECOND),
taji_orderflow::book,
)
});

Books::of(sub.item()).every(SECOND) asks the hub for the book once a second; taji_orderflow::book turns each frame into a row, bids positive and asks negative. The picture is the plugin playing its own recording, not the market:

A replayed ESZ26 1-minute chart, zoomed to a few minutes: a liquidity heatmap of coloured cells behind and after the candles, trade bubbles over it, best bid and ask lines, the resting book as bars at the right edge, and a Cumulative delta pane below

On a real book it reads what your provider streams: Draw an order-flow heatmap.

Who traded, and on which side​

Delta from each print's own side, summed per candle by a script of a few lines.

Order flow gives each print a side, 1 where the buyer crossed the spread and -1 where the seller did: the feed's where it states one, else the tick rule's estimate, marked estimated. Its delta product is each second's buy and sell size, and cvd, the indicator the plugin ships in plugins/taji-orderflow/indicators/cvd.ts, sums it, restarting each session; it is the Cumulative delta pane in the picture above. Pine's nearest reads are request.footprint(), which classes volume as buy or sell from intrabar price action, once a script and on Premium or Ultimate only,4 and each tick's aggressor on a 1-tick chart.5

import { data, indicator, input, plot } from "@taji/indicators";

export default indicator({
name: "Cumulative delta",
pane: "own",
inputs: {
session: input.anchor("session"),
},
data: {
flow: data.product("taji-orderflow.delta"),
},
plots: {
cvd: plot.line({ title: "CVD", unit: "count" }),
},
setup: () => ({ sum: 0 }),
next(_bar, s, { inputs, data: feed }) {
if (inputs.session.starts) s.sum = 0;
for (const row of feed.flow.rows) s.sum += row.delta;
return { cvd: s.sum };
},
});

feed.flow.rows holds the delta rows that became knowable inside this bar, oldest first, so the loop adds each second once.

The option chain​

Gamma by strike, the flip and the walls, from the chain's own IV and open interest.

A plugin reads the hub's chains: each contract's quote, open interest, IV and greeks. GEX prices the chain every 60 seconds and serves dealer exposure at spot, by strike, by expiry and at hypothetical spots, each estimate marked as one. No Pine request.*() function reads an option chain.4 The plugin's loop, in plugins/taji-gex/src/main.rs:

for batch in cx.stream(Chains::of(sub.item()).every(Duration::from_secs(60)))? {
if let Some(priced) = price_batch(&batch, &opts)
&& sub.push(row(&priced)).is_err()
{
break;
}
}

And the read in its gex_net indicator, plugins/taji-gex/indicators/gex_net.ts:

data: ({ inputs }) => ({
gex: data.product("taji-gex.levels", { lens: inputs.lens, expiries: inputs.expiries, units: inputs.units }),
}),

A replayed 1-minute S&amp;P 500 chart with the GEX levels drawn at the right: a gold flip line, the magnet, the put wall and max pain, and at the right edge two docks, net exposure by hypothetical spot and by strike

On a Taji with no key it reads Yahoo's delayed chain; the recipe plays the plugin's made-up chains: Chart dealer gamma exposure.

Any vendor or file​

A data source of your own in one short Python file.

A source plugin answers the hub's reads from a vendor or a file, and a chart pinned to it draws its bars like any other. Pine's counterpart is request.seed(), data from a GitHub repository its author maintains.4 This one serves daily bars from a CSV in the plugin's own directory, from Chart your own CSV of daily bars:

@p.read("bars")
def bars(ask):
path = os.path.join(os.environ["HOME"], ask["asked"] + ".csv")
if not os.path.exists(path):
raise taji.Refused(404, "not_listed", f"no {ask['asked']}.csv")
lo, hi = ask["from"], ask["to"]
rows = []
with open(path, newline="") as f:
for r in csv.DictReader(f):
ts = calendar.timegm(datetime.date.fromisoformat(r["date"]).timetuple())
if (lo is None or ts >= lo) and (hi is None or ts < hi):
rows.append({"ts_utc": ts, **{k: r[k] for k in ("open", "high", "low", "close", "volume")}})
return rows

A daily SPY chart pinned to CSV source, drawing the CSV&#39;s bars and nothing before them

Written for your agent​

Taji is built to be written by your agent; Pine is built to be written by you, in its editor.

  1. TradingView's MCP server checks Pine against the real compiler, runs indicators and backtests, and saves scripts to your account, each call counting against 10 to 500 a day by plan; protected and invite-only scripts stay closed to it.3
  2. Taji's author is your agent, with no daily count: it writes TypeScript, a language agents write fluently, sends it with indicators/write over MCP and binds it with add_indicator. A refused write answers 422 with the diagnostic's line and column or the failed invariant, which is the agent's next edit (Your first indicator).
  3. Taji never type-checks; your agent's editor does, against taji.d.ts, which declares @taji/indicators whole. A misspelt input or a plot option of the wrong type fails there, before the kernel sees the source.
  4. Every distinct write is the next immutable version, name@1, name@2, a file in your desk's directory that you read and review. A binding on the bare name follows the latest; one on name@N and every alert stay on theirs (Execution). Pine versions libraries, which importers pin, and keeps a version history for published scripts.1314

The editor's settings that make the check, with taji.d.ts copied beside your source:

{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"noEmit": true,
"types": [],
"paths": { "@taji/indicators": ["./taji.d.ts"] }
},
"include": ["*.ts"]
}

Execution​

Both run bar by bar and roll a tick back. Pine runs on TradingView's servers; Taji runs on your machine.

  1. Pine is cloud-based: a script runs on TradingView's servers, which limit the data it requests, its execution time, its memory and its size.1 A Taji indicator runs in the kernel on your machine, in one V8 isolate on its own thread that every desk's scripts share, each distinct source in a context of its own (Execution).
  2. A Pine script runs from the first bar to the last, once per historical bar, then again on every tick of the open bar.9 A Taji definition splits that in two: setup runs once per instance and returns the state, then next runs once per bar, oldest first, and once per tick of the forming bar (The indicator SDK).
  3. Before each recalculation on an open bar, Pine resets the script's data to its state when the bar opened, and only the last tick's values are committed.9 Taji does the same: a tick runs next from the state the previous bar committed, and only a close commits; a tick's drawings and log lines roll back with it (Execution).
  4. Pine's varip declares a variable that does not revert to the committed state, so it can count ticks, and it can repaint.9 Taji has no counterpart: every tick starts from the last close, and a write fails a script whose closed value depends on how many ticks came before it.

The same moving-average cross in each. The Pine is TradingView's own strategy example, verbatim;8 its two strategy.entry orders have no counterpart in an indicator, so the Taji version draws the cross as markers instead:

// Taji
import { indicator, input, plot, ta } from "@taji/indicators";

export default indicator({
name: "Simple MA cross",
pane: "price",
inputs: { length: input.int(14, { min: 2, title: "Base length" }) },
plots: {
fast: plot.line({ title: "Fast MA", color: "#00bcd4" }),
slow: plot.line({ title: "Slow MA", color: "#ff9800" }),
up: plot.marker({ shape: "triangle-up", at: "below" }),
down: plot.marker({ shape: "triangle-down", at: "above" }),
},
setup: ({ inputs }) => ({
fast: ta.sma(inputs.length),
slow: ta.sma(inputs.length * 2),
up: ta.crossUp(),
down: ta.crossDown(),
}),
next(bar, s) {
const fast = s.fast.next(bar.close);
const slow = s.slow.next(bar.close);
return {
fast,
slow,
up: s.up.next(fast, slow) ? bar.low : NaN,
down: s.down.next(fast, slow) ? bar.high : NaN,
};
},
});

Pine computes ta.sma(close, lengthInput) where it is written. Taji makes each ta handle once in setup and feeds it in next, on every bar and never under an if, because a bar a handle skips is a bar missing from its window. color.aqua and color.orange are #00bcd4 and #ff9800 in Taji's colour words.

The varip construct, from Pine's execution-model page:9

//@version=6
indicator("Executions on realtime bars demo")
//@variable Tracks the number of script executions, where 1 represents the first execution.
varip int executions = 0
// Add 1 to the `executions` value.
executions += 1

There is no Taji version of it. The nearest Taji counter counts bars, not executions, because each tick adds one to the count the last close committed:

// Taji
import { indicator, plot } from "@taji/indicators";

export default indicator({
name: "Bars counted",
pane: "own",
plots: { count: plot.line({ title: "Bars" }) },
setup: () => ({ count: 0 }),
next(_bar, s) {
s.count += 1;
return { count: s.count };
},
});

State and history​

Pine has a history operator. Taji keeps history in state.

  1. In Pine, x[k] reads a series k bars back: up to 5,000 bars for most series and 10,000 for open, high, low, close and time. Pine sizes each buffer from the first 244 bars, max_bars_back sets it by hand, and reading past it on a realtime bar is runtime error RE10143.69
  2. Pine's var initialises a variable once and keeps its value across bars.9 In Taji every value that outlives a bar is a field of the state setup returns, which the kernel copies on every close and restores before every tick.
  3. A Taji number is a plain JavaScript double, not a series, so there is no x[1]: keep s.prev = x at the end of next, or an array in state for a longer lookback. One mechanism covers ticks too, since the state is restored with everything else (The indicator SDK).
  4. Pine's ta namespace holds many built-ins, ta.sma, ta.crossover, ta.rsi and ta.highest among them.81512 Taji's ta holds seven: sma, ema, rma, rsi, change, crossUp and crossDown, the same Rust the built-in indicators run, so ta.rsi(14) gives the built-in RSI's numbers bit for bit. Every other function is written in state from its formula.

A highest high, kept as an array in state:

// Taji
import { indicator, input, plot } from "@taji/indicators";

export default indicator({
name: "Highest high",
pane: "price",
inputs: { length: input.int(20, { min: 1 }) },
plots: { highest: plot.step({ title: "Highest high" }) },
setup: () => ({ highs: [] as number[] }),
next(bar, s, { inputs }) {
s.highs.push(bar.high);
if (s.highs.length > inputs.length) s.highs.shift();
return { highest: s.highs.length < inputs.length ? NaN : Math.max(...s.highs) };
},
});

The state holds plain data and ta or drawing handles only: a function, a class instance, a Map or a Date is refused, because a copy that flattened it would lose it silently.

Missing values​

In Taji the missing value is NaN, and a plot draws nothing for it.

  1. A plot whose next returns NaN, leaves its key out or returns something other than a number draws nothing on that bar, and is served as null. undefined and null are never the missing value.
  2. A ta primitive answers NaN until it has enough bars, and NaN carries through arithmetic, so a warm-up needs no code of yours.
  3. series.na(x), series.nz(x, y) and series.fixnan(x, prev) test, fill and carry a missing value, with prev kept in state. The porting guide maps Pine's na, nz and fixnan to them.
  4. series.eq, ne, gt, ge, lt and le treat two numbers within 1e-10 as equal, and every comparison with NaN is false except ne. JavaScript's own == and < stay exact: choose the comparison you mean (The indicator SDK).

A level that holds the close of the last cross up until the next one:

// Taji
import { indicator, input, plot, series, ta } from "@taji/indicators";

export default indicator({
name: "Last cross level",
pane: "price",
inputs: { length: input.int(20, { min: 2 }) },
plots: {
avg: plot.line({ title: "Average" }),
level: plot.step({ title: "Close at the last cross up", color: "#089981" }),
},
setup: ({ inputs }) => ({ avg: ta.sma(inputs.length), up: ta.crossUp(), level: NaN }),
next(bar, s) {
const avg = s.avg.next(bar.close);
const cross = s.up.next(bar.close, avg) ? bar.close : NaN;
s.level = series.fixnan(cross, s.level);
return { avg, level: s.level };
},
});

Inputs​

The same input kinds and dialog keys; Taji's declaration is also your agent's schema.

  1. Pine's inputs are input.int, float, bool, color, string, text_area, timeframe, symbol, session, source, time, price and enum, with group, inline, tooltip, confirm, active and options.16 Taji's are input.int, float, bool, choice, text, color, session, interval, symbol, time, price, source and anchor, taking the same option keys.
  2. A Taji definition holds at most 32 inputs, and confirm, which asks you to click the chart as the indicator is added, works on time and price only.
  3. The kernel turns the inputs into one JSON Schema. The window draws it as the settings dialog, and your agent reads it as the indicator's catalog row, so both offer the same choices within the same bounds. Each value is checked at write (the defaults) and at bind (the binding's values), naming the input that breaks a rule.
  4. A source input is a bar field or another indicator's plot, and an anchor input says per bar whether a session, week, month or longer period starts, from the instrument's calendar. Both are per-bar values, read in next, never in setup.
  5. The resolved inputs are part of the instance's key: two bindings with equal inputs on one series share one computation (Inputs).
// Taji
import { indicator, input, plot, ta } from "@taji/indicators";

export default indicator({
name: "Average of a source",
pane: "price",
inputs: {
src: input.source("close", { title: "Source" }),
kind: input.choice("ema", { options: ["sma", "ema", "rma"], title: "Average", group: "Average", inline: "avg" }),
length: input.int(20, { min: 1, max: 500, title: "Length", group: "Average", inline: "avg" }),
},
plots: { avg: plot.line({ title: "Average" }) },
setup: ({ inputs }) => ({ avg: ta[inputs.kind](inputs.length) }),
next(_bar, s, { inputs }) {
return { avg: s.avg.next(inputs.src) };
},
});

A choice input types as the union of its options, so ta[inputs.kind] type-checks, and a misspelt option is an error in your editor before the write.

Outputs​

Taji's drawing limits match Pine's; a definition serves 32 plot columns to Pine's 64.

  1. A Pine script has up to 64 plots, and one call can make up to 7 of them.6 A Taji definition serves up to 32 columns, a candle or bar counting four, and 16 fills.
  2. Pine draws up to 500 lines, boxes and labels and 100 polylines, 50 of each by default, deleting the oldest past the cap; a polyline holds up to 10,000 points.617 Taji's caps are the same numbers, set with max_lines, max_labels, max_boxes and max_polylines: a kind holds up to its cap plus 5, then deletes its oldest down to the cap.
  3. With xloc.bar_index, Pine draws from 10,000 bars back to 500 forward.6 Taji's bar-index reach is the same; xloc: "bar_time" places an x at any instant.
  4. Pine allows 9 tables, one per chart position, a new one taking the place of the last.611 Taji holds one table or card per position, the newest winning, a table 1 to 20 columns by 1 to 100 rows.
  5. A Taji colour is one of three: a fixed colour, a palette of 1 to 8 whose slot next returns per bar, or a colour computed per bar. A palette keeps what the script decides (which slot) apart from how it looks (the colours), so a binding's style can recolour it without recomputing.
  6. Every Taji output is a column the kernel serves: the window draws it, your agent reads the same rows with GET /get/indicators, and an alert compares one plot (Outputs).
// Taji
import { fill, indicator, input, label, plot, ta } from "@taji/indicators";

export default indicator({
name: "RSI zones",
pane: "own",
inputs: { length: input.int(14, { min: 2 }) },
plots: {
rsi: plot.line({ title: "RSI", colors: ["#f23645", "#787b86", "#089981"] }),
bounds: plot.levels([30, 70]),
},
fills: { band: fill(70, 30, { color: "#7e57c2", alpha: 0.1 }) },
max_labels: 20,
setup: ({ inputs }) => ({ rsi: ta.rsi(inputs.length), over: ta.crossUp() }),
next(bar, s, { ctx }) {
const rsi = s.rsi.next(bar.close);
if (s.over.next(rsi, 70)) label.new({ x: ctx.index, y: rsi, text: "70" });
const slot = rsi > 70 ? 0 : rsi < 30 ? 2 : 1;
return { rsi, colors: { rsi: slot } };
},
});

Alerts are outside the script. Pine has alertcondition() in indicators and alert() with a message built per bar, and its alerts run around the clock on TradingView's servers from a saved copy of the script and its inputs.15 A Taji script has no alert call: you bind it, then add an alert whose operand is one of its plots. The alert pins the indicator's version (name@N), reads the chart's own instance where the desk shows it, and fires with the desk off screen, in your kernel.

Other data​

Pine requests other data in the script body; Taji declares it before the first bar.

  1. Pine's request.*() functions are calls in the script.4 A Taji script names every other series in data, so the kernel fetches it, computes it once for every reader of that series and aligns it to your bars by the instrument's calendar before next first runs. No call inside next fetches anything.
  2. data may be a function of the inputs, so an interval can be a setting: data: ({ inputs }) => ({ htf: data.bars({ interval: inputs.tf }) }).
  3. A higher interval gives .last and .changed, and depth adds .at(k) up to 500 bars back. A finer interval gives .intrabars. Events give .last and .changed. Every read is as of this bar's close.
  4. A frozen pane is never fed, so a script with data faults there (Inputs).

Pine reads three kinds of data that an indicator does not take as an input (Inputs):

ReadsTajiPine
Financial statementsNot an inputrequest.financial(), FactSet data4
Economic seriesNot an inputrequest.economic()4
Currency conversionNot an inputrequest.currency_rate()4
// Taji
import { data, indicator, plot } from "@taji/indicators";

export default indicator({
name: "Daily close and dividends",
pane: "price",
data: { day: data.bars({ interval: "D" }), divs: data.events("dividends") },
plots: {
daily: plot.step({ title: "Last daily close" }),
ex_date: plot.marker({ shape: "circle", at: "above" }),
},
setup: () => ({}),
next(bar, _s, { data }) {
return {
daily: data.day.last.close,
ex_date: data.divs.changed ? bar.high : NaN,
};
},
});

Repainting​

Pine's lookahead is an argument; Taji has none to set.

  1. request.security() defaults to lookahead_off. With lookahead_on and no historical offset, history sees higher-timeframe values before they happened, realtime values can then repaint after a reload, and such scripts cannot be published. close[1] with lookahead_on is the form the manual recommends.4
  2. Every Taji read is as of this bar's close. asof: "open" moves the cut to this bar's open, the documented counterpart of expr[1] with lookahead_on; the counterpart of lookahead_on with no offset is not built, because it reads the future.
  3. Two Taji reads can repaint, and each marks the binding repaints in its served metadata: data.<n>.forming, the higher bar still in progress, and calc with calc_closes off (Execution).
  4. A closed bar's Taji value changes only when its instance recomputes from its first bar: after a backfill, a restated bar or an out-of-order event.

A daily close with no lookahead. The Pine is a minimal form of the pattern on the manual's page, not a verbatim copy:4

// Taji
import { data, indicator, plot } from "@taji/indicators";

export default indicator({
name: "Daily close, no lookahead",
pane: "price",
data: { d: data.bars({ interval: "D", asof: "open" }) },
plots: { daily: plot.line({ title: "Daily close", color: "#089981", width: 2 }) },
setup: () => ({}),
next(_bar, _s, { data }) {
return { daily: data.d.last.close };
},
});

The Taji version declares the daily series in data, so there is no call inside the bar loop and no lookahead argument to get wrong.

Testing​

Every Taji write is tested before it is stored, and may carry tests of its own.

  1. The kernel compiles the source, runs it over a fixed fixture of 1,024 bars and checks three invariants: a second run gives bitwise the same rows (determinism), the first half of the history equals the first half of the whole (prefix), and ticks of a bar followed by its close give the close alone (ticks then close). A failure names the first differing row, and nothing is stored (Execution).
  2. A write may carry a test: a module whose default export maps names to functions of t. t.run(params, closes) runs the indicator over bars made from closes, and t.assert and t.near check the rows. indicators/test reruns the stored test; indicators/check runs every check without storing.
  3. Pine's debugging tools are logs and a profiler: log.info(), log.warning() and log.error() write to the Pine Logs pane for personal scripts, keeping the most recent 10,000 historical entries, and the Pine Profiler times each line.1112 Taji's log(message) keeps a line only on a close and shows the newest 200 in the write's report; a fault names its bar, line and column. Taji has no profiler.

A test for the highest high above, stored beside its source:

// Taji
import type { T } from "@taji/indicators";

export default {
"the highest of the last three bars"(t: T) {
const r = t.run({ length: 3 }, [1, 5, 2, 3, 4, 1]);
t.assert(r.highest[1] !== r.highest[1], "missing before the third bar");
t.assert(r.highest[3] === 5, "5 is still in the window");
t.assert(r.highest[4] === 4, "5 has left it");
},
};

Summary​

TajiPine
LanguageTypeScript, types stripped and run in V8Pine Script v6, TradingView's own1
Where it runsThe kernel on your machineTradingView's servers1
Who writes itYour agent, type-checked against taji.d.ts before the writeYou, in the Pine Editor;2 or an agent through TradingView's MCP server3
Per barsetup once, next per bar and per tickThe whole script, then again per tick9
Tick rollbackYes, alwaysYes; varip escapes it9
HistoryState: s.prev, arrays; depth up to 500 on datax[k], up to 5,000 bars (10,000 for OHLC and time)6
taSeven primitives, the built-ins' own codeMany built-ins8
Other datadata: other intervals and symbols, intrabars, events, hub and plugin productsrequest.*: other intervals and symbols, intrabars, events, financials, economic, seed, footprint;46 bid, ask and aggressor_side on 1-tick charts5
ExtensionsPlugins: verbs and nodes, data sources and products, panes, chart layers and indicators of their ownLibraries13
LookaheadNone; asof: "open" for the bar beforeAn argument, off by default4
Inputs13 kinds, at most 32, one schema for dialog and agent13 kinds16
Plots32 columns, 16 fills646
Drawings500 lines, labels, boxes; 100 polylines500 lines, labels, boxes; 100 polylines6
TablesOne table or card per position9, one per position6
AlertsOutside the script, on a plot, version pinned, in your kernelalertcondition(), alert(), on TradingView's servers15
StrategiesNonestrategy() and its strategy report8
LibrariesOne file; scripts compose through source inputslibrary() and import13
Checks before it runsThe compiler, three invariants and your own tests, on every writeThe compiler3
Debugginglog on closes, faults with bar, line and columnPine Logs and the Pine Profiler1112
CPU limitsCompile, history or test 1 s; setup, tick or close 50 msCompile 2 minutes; 500 ms per loop per bar6
Memory and size256 MB heap; source 256 KiB100,256 compiled tokens; 100,000 collection elements6
VersionsEvery write a version, name@N; bindings and alerts pinLibraries pinned by importers; published history1314

Bring your Pine scripts​

Your agent ports a Pine indicator by the skill's porting guide: it reads the script whole, stops and tells you if it uses a construct Taji does not port (varip, strategy.*, libraries, request.financial and the others it lists), maps each line, writes the indicator with a test, binds it and reads the last rows back for you to set beside your TradingView chart. The guide holds every mapping row, from close[1] to table.new; this page repeats none of them.

A ribbon of three exponential moving averages with the outer two shaded between, in each, written for this page. The Taji file is whole as it stands:

ema_ribbon.ts
import { fill, indicator, input, plot, ta } from "@taji/indicators";

export default indicator({
name: "EMA Ribbon",
pane: "price",
inputs: {
fast_length: input.int(8, { min: 2, title: "Fast length" }),
mid_length: input.int(21, { min: 2, title: "Middle length" }),
slow_length: input.int(55, { min: 2, title: "Slow length" }),
},
plots: {
fast: plot.line({ title: "Fast", color: "#00bcd4" }),
mid: plot.line({ title: "Middle", color: "#ff9800" }),
slow: plot.line({ title: "Slow", color: "#9c27b0" }),
},
fills: { ribbon: fill("fast", "slow", { color: "#2962ff", alpha: 0.15 }) },
setup: ({ inputs }) => ({
fast: ta.ema(inputs.fast_length),
mid: ta.ema(inputs.mid_length),
slow: ta.ema(inputs.slow_length),
}),
next(bar, s) {
return { fast: s.fast.next(bar.close), mid: s.mid.next(bar.close), slow: s.slow.next(bar.close) };
},
});

The EMA Ribbon on a daily SPY chart: three moving averages, the outer two shaded between

The Pine indicator(..., overlay = true) line became name and pane: "price"; each input.int line became an entry of inputs; each ta.ema(close, n) line became a ta.ema(n) in setup and its .next(bar.close) in next; each plot line became an entry of plots; and fill(fast_plot, slow_plot, color.new(color.blue, 85)) became fills: { ribbon: fill("fast", "slow", { color: "#2962ff", alpha: 0.15 }) }, where alpha is 1 minus the transparency over 100.

The kernel's last ten rows of the ribbon, newest last:

[
{
"start_dt": "2026-11-19T00:00:00+00:00",
"fast": 132.24455713364225,
"mid": 131.07414366320012,
"slow": 128.294531303195
},
{
"start_dt": "2026-11-20T00:00:00+00:00",
"fast": 132.93909999283287,
"mid": 131.46467605745465,
"slow": 128.54722661379517
},
{
"start_dt": "2026-11-23T00:00:00+00:00",
"fast": 133.78818888331446,
"mid": 131.9460691431406,
"slow": 128.84053994901677
},
{
"start_dt": "2026-11-24T00:00:00+00:00",
"fast": 134.57303579813347,
"mid": 132.434608311946,
"slow": 129.14337780798047
},
{
"start_dt": "2026-11-25T00:00:00+00:00",
"fast": 135.67458339854826,
"mid": 133.0796439199509,
"slow": 129.5143286005526
},
{
"start_dt": "2026-11-27T00:00:00+00:00",
"fast": 136.52689819887087,
"mid": 133.66422174540992,
"slow": 129.87131686481857
},
{
"start_dt": "2026-11-30T00:00:00+00:00",
"fast": 137.28314304356624,
"mid": 134.23383795037265,
"slow": 130.2305555482179
},
{
"start_dt": "2026-12-01T00:00:00+00:00",
"fast": 137.98022236721818,
"mid": 134.79621631852058,
"slow": 130.59446427863867
},
{
"start_dt": "2026-12-02T00:00:00+00:00",
"fast": 138.69350628561415,
"mid": 135.37746938047326,
"slow": 130.9728762686873
},
{
"start_dt": "2026-12-03T00:00:00+00:00",
"fast": 139.56606044436657,
"mid": 136.0358812549757,
"slow": 131.38884497337702
}
]

Captured 2026-12-04 on a headless kernel reading a made-up daily series for SPY.

See also​

Footnotes​

  1. Welcome to Pine Script v6, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10

  2. First indicator, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4

  3. TradingView MCP: Pine Script and daily limits, TradingView blog, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  4. Other timeframes and data, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15 ↩16 ↩17 ↩18 ↩19 ↩20 ↩21 ↩22 ↩23 ↩24 ↩25 ↩26 ↩27

  5. Release notes, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  6. Limitations, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15 ↩16

  7. Script structure, fetched 2026-12-03. ↩

  8. Strategies, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5

  9. Execution model, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9

  10. What are tick-based intervals for?, TradingView help center, fetched 2026-12-03. ↩ ↩2

  11. Debugging, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4

  12. Profiling and optimization, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4

  13. Libraries, fetched 2026-12-03. ↩ ↩2 ↩3 ↩4

  14. Publishing scripts, fetched 2026-12-03. ↩ ↩2

  15. Alerts, fetched 2026-12-03. ↩ ↩2 ↩3

  16. Inputs, fetched 2026-12-03. ↩ ↩2

  17. Lines and boxes, fetched 2026-12-03. ↩