Major improvements and design changes between kScript v1 and v2. Learn what's new in the latest version.
This document highlights the major improvements and design changes between kScript v1 and kScript v2. The goal of v2 is to make scripting more intuitive, powerful, and performant for indicator developers.
1. Execution Model
Execution was line-by-line and evaluated expressions directly
Developers had to manually assemble time-aligned series using:
buildTimeseries(...)
mergeTimeseries(...)
matchTimestamp(...)
timeseries(...) constructor
This was unintuitive and often led to performance bottlenecks
Introduces per-bar execution model, similar to Pine Script
Script phases:
Initialization → definitions, inputs, data subscriptions
Calculation → runs once per bar
Plotting → render output
No need for manual alignment; the engine handles timeseries iteration automatically
2. Keyword Arguments (kwargs)
Functions accepted only positional arguments, making scripts harder to read and maintain.
v1 Positional Arguments
plotLine(rsiTs, 3, ["red", "green"])
All functions now support keyword arguments (kwargs). More readable and order-independent.