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
| Taji | Pine Script | |
|---|---|---|
| Language | TypeScript for indicators; Rust or Python for plugins: open and industry-standard | Pine Script v6, TradingView's own1 |
| Written by | Your coding agent, such as Claude Code, Codex or Cursor, from a prompt | You, in the Pine Editor;2 an agent only through TradingView's MCP server, 10 to 500 calls a day by plan3 |
| Checked before it runs | Your agent's type checker against taji.d.ts, then the compiler, three invariants and your own tests, on every write | The compiler3 |
| Reads | Bars, events, the tape, quotes and auction imbalance; through a plugin, the order book, option chains with greeks and any vendor or file | Bars, events, financials, economic series and a volume footprint; bid, ask and the aggressor on 1-tick charts45 |
| Speed | ta primitives and the built-ins are compiled Rust; your script runs in V8 on your machine | Limited in execution time, memory and size on TradingView's servers16 |
| Where it runs | Your machine | TradingView'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 indicator | Taji plugin | Pine script | |
|---|---|---|---|
| What it is | One 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 |
| Language | TypeScript | Rust or Python for its process; TypeScript for its panes, layers and indicators | Pine Script v61 |
| What it adds | Plots, 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 reads | The 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 directory | Its chart's data and the request.*() functions4 |
| Where it runs | The kernel on your machine, in V8 | Its 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 window | TradingView's servers1 |
| Who uses it | You and your agent bind it to a chart, and an alert reads its plot | Your agent calls its verbs and reads its nodes; Taji's window draws its panes and layers; your indicators read its products | You, 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.
| Data | Taji | Pine |
|---|---|---|
| Bars and volume | Indicator: 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 intervals | Indicator: 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 bar | Indicator: .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, earnings | Indicator: data.events("dividends"), "splits", "earnings", each from the first bar it is knowable | request.dividends(), request.splits(), request.earnings()4 |
| The trade tape | Indicator: data.product("trades"), each print with its aggressor where the source states it; Yahoo streams it live | On a 1-tick chart, a bar per tick, with aggressor_side since November 2026105 |
| Best bid and ask | Indicator: data.product("quotes"), bid and ask with their sizes; Yahoo streams them | bid and ask, on the 1-tick timeframe only5 |
| Auction imbalance | Indicator: data.product("imbalance"), the imbalance a venue publishes before an open or close, from your provider | None of the request.*() functions4 |
| The order book, level by level | Plugin: streams the hub's depth and serves rows an indicator reads, as Order flow's taji-orderflow.book; from your provider | None of the request.*() functions4 |
| Buy and sell volume | Plugin: Order flow's prints and delta, each print's side the feed's or the tick rule's; its cvd indicator sums the delta | request.footprint(), buy and sell volume by price row, classed from intrabar price action; one call a script, Premium or Ultimate4 |
| Off-exchange prints | Plugin: Dark pool's taji-darkpool.prints and levels, the prints reported to a FINRA facility; from your provider | None of the request.*() functions4 |
| Option chains with greeks | Plugin: reads chains, each contract's IV, delta, gamma, theta, vega and rho, computed by Taji where the vendor sends none; Yahoo's delayed chain | None of the request.*() functions4 |
| Dealer gamma exposure | Plugin: GEX's levels, strikes, curve and expiries, which an indicator reads with data.product("taji-gex.levels"); from Yahoo's delayed chain | None of the request.*() functions4 |
| Any vendor or file | Plugin: 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 arerequest.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:

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 }),
}),

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

Written for your agent
Taji is built to be written by your agent; Pine is built to be written by you, in its editor.
- 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
- Taji's author is your agent, with no daily count: it writes TypeScript, a language agents write fluently, sends it with
indicators/writeover MCP and binds it withadd_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). - Taji never type-checks; your agent's editor does, against
taji.d.ts, which declares@taji/indicatorswhole. A misspelt input or a plot option of the wrong type fails there, before the kernel sees the source. - 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 onname@Nand 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.
- 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).
- 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:
setupruns once per instance and returns the state, thennextruns once per bar, oldest first, and once per tick of the forming bar (The indicator SDK). - 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
nextfrom the state the previous bar committed, and only a close commits; a tick's drawings and log lines roll back with it (Execution). - Pine's
varipdeclares 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
- Pine
// 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,
};
},
});
//@version=6
strategy("Simple strategy demo", overlay = true)
//@variable Defines the lengths of the fast and slow moving averages.
int lengthInput = input.int(14, "Base length", minval = 2)
// Calculate a fast MA using the `lengthInput` value and a slow MA using twice that value.
float fastMA = ta.sma(close, lengthInput)
float slowMA = ta.sma(close, lengthInput * 2)
// If the fast MA crosses over the slow MA, place an order to close any short position and enter a long position.
if ta.crossover(fastMA, slowMA)
strategy.entry("Buy", direction = strategy.long)
// If the fast MA crosses under the slow MA, place an order to close any long position and enter a short position.
if ta.crossunder(fastMA, slowMA)
strategy.entry("Sell", direction = strategy.short)
// Plot both moving averages for reference.
plot(fastMA, "Fast MA", color.aqua)
plot(slowMA, "Slow MA", color.orange)
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.
- In Pine,
x[k]reads a serieskbars 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_backsets it by hand, and reading past it on a realtime bar is runtime error RE10143.69 - Pine's
varinitialises a variable once and keeps its value across bars.9 In Taji every value that outlives a bar is a field of the statesetupreturns, which the kernel copies on every close and restores before every tick. - A Taji number is a plain JavaScript double, not a series, so there is no
x[1]: keeps.prev = xat the end ofnext, 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). - Pine's
tanamespace holds many built-ins,ta.sma,ta.crossover,ta.rsiandta.highestamong them.81512 Taji'staholds seven:sma,ema,rma,rsi,change,crossUpandcrossDown, the same Rust the built-in indicators run, sota.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.
- A plot whose
nextreturnsNaN, leaves its key out or returns something other than a number draws nothing on that bar, and is served as null.undefinedandnullare never the missing value. - A
taprimitive answersNaNuntil it has enough bars, andNaNcarries through arithmetic, so a warm-up needs no code of yours. series.na(x),series.nz(x, y)andseries.fixnan(x, prev)test, fill and carry a missing value, withprevkept in state. The porting guide maps Pine'sna,nzandfixnanto them.series.eq,ne,gt,ge,ltandletreat two numbers within 1e-10 as equal, and every comparison withNaNis false exceptne. 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.
- Pine's inputs are
input.int,float,bool,color,string,text_area,timeframe,symbol,session,source,time,priceandenum, withgroup,inline,tooltip,confirm,activeandoptions.16 Taji's areinput.int,float,bool,choice,text,color,session,interval,symbol,time,price,sourceandanchor, taking the same option keys. - A Taji definition holds at most 32 inputs, and
confirm, which asks you to click the chart as the indicator is added, works ontimeandpriceonly. - 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.
- A
sourceinput is a bar field or another indicator's plot, and ananchorinput says per bar whether a session, week, month or longer period starts, from the instrument's calendar. Both are per-bar values, read innext, never insetup. - 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.
- 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.
- 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_boxesandmax_polylines: a kind holds up to its cap plus 5, then deletes its oldest down to the cap. - 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. - 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.
- A Taji colour is one of three: a fixed colour, a palette of 1 to 8 whose slot
nextreturns 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. - 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.
- Pine's
request.*()functions are calls in the script.4 A Taji script names every other series indata, 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 beforenextfirst runs. No call insidenextfetches anything. datamay be a function of the inputs, so an interval can be a setting:data: ({ inputs }) => ({ htf: data.bars({ interval: inputs.tf }) }).- A higher interval gives
.lastand.changed, anddepthadds.at(k)up to 500 bars back. A finer interval gives.intrabars. Events give.lastand.changed. Every read is as of this bar's close. - A frozen pane is never fed, so a script with
datafaults there (Inputs).
Pine reads three kinds of data that an indicator does not take as an input (Inputs):
| Reads | Taji | Pine |
|---|---|---|
| Financial statements | Not an input | request.financial(), FactSet data4 |
| Economic series | Not an input | request.economic()4 |
| Currency conversion | Not an input | request.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.
request.security()defaults tolookahead_off. Withlookahead_onand 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]withlookahead_onis the form the manual recommends.4- Every Taji read is as of this bar's close.
asof: "open"moves the cut to this bar's open, the documented counterpart ofexpr[1]withlookahead_on; the counterpart oflookahead_onwith no offset is not built, because it reads the future. - Two Taji reads can repaint, and each marks the binding
repaintsin its served metadata:data.<n>.forming, the higher bar still in progress, andcalcwithcalc_closesoff (Execution). - 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
- Pine
// 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 };
},
});
//@version=6
indicator("HTF close demo", overlay = true)
float dailyClose = request.security(syminfo.tickerid, "1D", close[1], lookahead = barmerge.lookahead_on)
plot(dailyClose, "Daily close", color.teal, 2)
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.
- 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).
- A write may carry a
test: a module whose default export maps names to functions oft.t.run(params, closes)runs the indicator over bars made from closes, andt.assertandt.nearcheck the rows.indicators/testreruns the stored test;indicators/checkruns every check without storing. - Pine's debugging tools are logs and a profiler:
log.info(),log.warning()andlog.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'slog(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
| Taji | Pine | |
|---|---|---|
| Language | TypeScript, types stripped and run in V8 | Pine Script v6, TradingView's own1 |
| Where it runs | The kernel on your machine | TradingView's servers1 |
| Who writes it | Your agent, type-checked against taji.d.ts before the write | You, in the Pine Editor;2 or an agent through TradingView's MCP server3 |
| Per bar | setup once, next per bar and per tick | The whole script, then again per tick9 |
| Tick rollback | Yes, always | Yes; varip escapes it9 |
| History | State: s.prev, arrays; depth up to 500 on data | x[k], up to 5,000 bars (10,000 for OHLC and time)6 |
ta | Seven primitives, the built-ins' own code | Many built-ins8 |
| Other data | data: other intervals and symbols, intrabars, events, hub and plugin products | request.*: other intervals and symbols, intrabars, events, financials, economic, seed, footprint;46 bid, ask and aggressor_side on 1-tick charts5 |
| Extensions | Plugins: verbs and nodes, data sources and products, panes, chart layers and indicators of their own | Libraries13 |
| Lookahead | None; asof: "open" for the bar before | An argument, off by default4 |
| Inputs | 13 kinds, at most 32, one schema for dialog and agent | 13 kinds16 |
| Plots | 32 columns, 16 fills | 646 |
| Drawings | 500 lines, labels, boxes; 100 polylines | 500 lines, labels, boxes; 100 polylines6 |
| Tables | One table or card per position | 9, one per position6 |
| Alerts | Outside the script, on a plot, version pinned, in your kernel | alertcondition(), alert(), on TradingView's servers15 |
| Strategies | None | strategy() and its strategy report8 |
| Libraries | One file; scripts compose through source inputs | library() and import13 |
| Checks before it runs | The compiler, three invariants and your own tests, on every write | The compiler3 |
| Debugging | log on closes, faults with bar, line and column | Pine Logs and the Pine Profiler1112 |
| CPU limits | Compile, history or test 1 s; setup, tick or close 50 ms | Compile 2 minutes; 500 ms per loop per bar6 |
| Memory and size | 256 MB heap; source 256 KiB | 100,256 compiled tokens; 100,000 collection elements6 |
| Versions | Every write a version, name@N; bindings and alerts pin | Libraries 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:
- Taji
- Pine
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) };
},
});
//@version=6
indicator("EMA Ribbon", overlay = true)
int fast_length = input.int(8, "Fast length", minval = 2)
int mid_length = input.int(21, "Middle length", minval = 2)
int slow_length = input.int(55, "Slow length", minval = 2)
float fast = ta.ema(close, fast_length)
float mid = ta.ema(close, mid_length)
float slow = ta.ema(close, slow_length)
fast_plot = plot(fast, "Fast", color.aqua)
plot(mid, "Middle", color.orange)
slow_plot = plot(slow, "Slow", color.purple)
fill(fast_plot, slow_plot, color.new(color.blue, 85))

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
- Indicators, the model and the life of an indicator.
- Your first indicator, write, bind and test one yourself.
- The indicator reference, every field, kind, default and limit.
- Plugins, what a plugin is and which kind you need.