---
title: Introducing kScript v2
description: >-
  kScript is designed to be intuitive whether you're coming from PineScript or
  learning to code for the first time. Create technical indicators, analyze
  market trends, and study order flow with powerful yet accessible tools. The
  syntax is straightforward and easy to learn — you'll be building working
  indicators in minutes.
---


## What Can You Build?

kScript gives you access to powerful data sources that most platforms don't offer.

<table data-view="cards"><tbody>
<tr><td>Custom Technical Indicators</td><td>Build indicators like RSI, moving averages, MACD, and Bollinger Bands with your own parameters and visual styles.</td><td></td></tr>
<tr><td>Multi-Symbol Analysis</td><td>Compare price movements across different assets. Track correlations, spreads, and relative strength between multiple symbols.</td><td></td></tr>
<tr><td>Order Book Analysis</td><td>Access order book data up to 2,000 levels deep. Visualize liquidity, find imbalances, and analyze market depth in real-time.</td><td></td></tr>
<tr><td>Cross-Exchange Studies</td><td>Aggregate data from multiple exchanges. Track price differences, liquidity flows, and arbitrage opportunities.</td><td></td></tr>
</tbody></table>


## Example Indicators

{% tabs %}
{% tab title="Beginner Example" %}
A complete indicator in just 5 lines:

```javascript title="The kScript"
//@version=2

define(title="My First Indicator", position="onchart", axis=true);

timeseries prices = ohlcv(symbol=currentSymbol, exchange=currentExchange);
timeseries average = sma(source=prices.close, period=20);

plotLine(value=average, colors=["blue"], width=2, label=["20 SMA"], desc=["20-period Simple Moving Average"]);
```

| Line   | What it does                      |
| ------ | --------------------------------- |
| Line 1 | Tell kScript this is version 2    |
| Line 3 | Set up your indicator's name      |
| Line 5 | Get price data from current chart |
| Line 6 | Calculate 20-period average       |
| Line 8 | Draw a blue line on chart         |

{% endtab %}

{% tab title="Advanced Example" %}
Advanced Example: RSI Indicator

Full-featured RSI with customizable inputs, smooth rendering, and proper styling:

```javascript title="RSI Indicator"
//@version=2

// Indicator definition
define(title="RSI", position="offchart", axis=true);

// Customizable user inputs
var splineColors = input(name="myColor", type="color", defaultValue="orange");
var width = input(name="width", type="number", defaultValue=2);
var period = input(name="period", type="number", defaultValue=26);
var smooth = input(name="smooth", type="boolean", defaultValue=true);

// Data subscription - load OHLCV data from the current chart
timeseries trade = ohlcv(symbol=currentSymbol, exchange=currentExchange);

// Local variable
var fill = true;

// Create RSI time series using the built-in technical indicator function "rsi()"
// The close price is accessed through trade.close property
var transformedData = rsi(source=trade.close, period=period);

// Prepare final plot data
var baseLine = 0;
var combinedData = [transformedData, baseLine];

// Actually plot the data
// Plot an area spline with baseline and RSI values
// Use "transparent" as the second line's color so it's hidden
plotLine(value=combinedData, colors=[splineColors, "transparent"], width=width, fill=fill, smooth=smooth, label=["RSI"], desc=["Relative Strength Index"]);
```

<figure class="docs-output">
  <figcaption class="docs-output-caption">
    <span class="docs-output-dot"></span>
    <span class="docs-output-label">Rendered output</span>
  </figcaption>
  <img src="/k-script/rsi-example.svg" alt="Rendered RSI indicator output">
</figure>
{% endtab %}
{% endtabs %}


## Why kScript?

<table data-view="cards"><tbody>
<tr><td>Familiar Yet Powerful</td><td>The syntax is designed to be easy to read and write. If you know PineScript, kScript will feel familiar. If you're new to coding, you'll find it straightforward to learn.</td><td></td></tr>
<tr><td>Built for Performance</td><td>The kScript runtime handles indicator calculations across long history windows efficiently. Each script's calculation phase runs under a 500ms per-bar budget — see the <a href="/kscript/faq/limitations">limitations</a> page for details.</td><td></td></tr>
<tr><td>Real-Time Execution</td><td>Indicators update instantly as market data changes. See your analysis in real-time without lag.</td><td></td></tr>
<tr><td>Years of Historical Data</td><td>Backtest your indicators with extensive historical datasets across all available data sources.</td><td></td></tr>
<tr><td>Institutional-Grade Data Sources</td><td>Access data that most platforms don't offer. Build sophisticated indicators using institutional-grade market intelligence.</td><td></td></tr>
<tr><td>Wide Exchange Coverage</td><td>Data from major centralized exchanges (Binance, Coinbase, OKX), derivatives platforms (Deribit, Hyperliquid), DEXs (Uniswap, SushiSwap, PancakeSwap), and price oracles (Pyth Network).</td><td></td></tr>
<tr><td>Developer-First Features</td><td>Live debugging with variables updating in real-time as the market moves, plus built-in version control for all your scripts with rollback capabilities.</td><td></td></tr>
</tbody></table>


## AI-Powered Development

Transform your AI assistant into a kScript expert. Our reference document teaches ChatGPT, Claude, and other LLMs the exact kScript syntax — no more debugging broken AI-generated code.

<table data-view="cards"><tbody>
<tr><td>Download Prompt</td><td>Get the kScript syntax guide optimized for LLMs.</td><td><a href="/downloads/kscript_reference_v2.txt"></a></td></tr>
<tr><td>Attach to AI</td><td>Upload the reference to your ChatGPT or Claude conversation.</td><td></td></tr>
<tr><td>Generate Code</td><td>Get working kScript with correct syntax every time.</td><td><a href="https://chart.kiyotaka.ai"></a></td></tr>
</tbody></table>

{% hint style="info" %}
While AI assistants become more helpful with our reference, always verify generated code. Complex strategies may need manual adjustments.
{% endhint %}


## Join the Beta Community

Your feedback is heard and implemented quickly — we've shipped 40+ community-requested features in the past month alone. Report a bug in the morning, see it fixed by afternoon. Suggest a function today, use it next week. This rapid iteration cycle means kScript evolves exactly how you need it to.

Join our Discord to:

- Get early access to new features and documentation
- Submit feedback that gets responded to within hours, not weeks
- Collaborate on code with other developers building advanced indicators
- Share and debug scripts together in real-time
- Help prioritize the development roadmap
- Request custom data sources and new functions

[Join the Kiyotaka Discord →](https://discord.gg/kiyotaka)


## Ready to start building?

Join thousands of traders using kScript to power their trading strategies with unprecedented market data access.

- [Get Started](/kscript/getting-started/quick-start)
- [Join Discord](https://discord.gg/kiyotaka)
- [Browse Reference](/kscript/reference/quick-reference)
