Comprehensive reference for all kScript functions, variables, and data types. Build powerful trading algorithms with our extensive library of technical indicators and utilities.
Variables & Constants
Core variables, data types, and constants available in kScript for market data access and styling.
Core Data Variables
Variable
Type
Description
currentSymbol
string
The current trading symbol (e.g., 'BTCUSDT')
currentExchange
string
The current exchange being used for trading (e.g., 'BINANCE', 'COINBASE')
currentCoin
string
The current trading coin (e.g., "BTC")
barIndex
number
Current bar index in the timeseries during the per-bar loop.
isLastBar
boolean
True when processing the last bar in the dataset.
isLiveUpdate
boolean
True during live data updates with new market data.
color
color
The color to use for plotting (e.g., 'red', 'blue')
Color Constants
Constant
Type
Description
yellow
color
Yellow color (#FFFF00)
orange
color
Orange color (#FFA500)
purple
color
Purple color (#800080)
gray
color
Gray color (#808080)
black
color
Black color (#000000)
white
color
White color (#FFFFFF)
red
color
Red color (#FF0000)
green
color
Green color (#008000)
blue
color
Blue color (#0000FF)
silver
color
Silver color (#C0C0C0)
maroon
color
Maroon color (#800000)
fuchsia
color
Fuchsia color (#FF00FF)
lime
color
Lime color (#00FF00)
olive
color
Olive color (#808000)
navy
color
Navy color (#000080)
teal
color
Teal color (#008080)
aqua
color
Aqua color (#00FFFF)
Data Types
Type
Description
timeseries
Time-aligned numerical data. Only timeseries data can be passed into plot functions.
ShapeType
Shape type used by plotShape(). Currently supports circle.
static
Variable that gets declared once and persists across bar iterations.
Data Sources
Data Source
Type
Description
binance_treasury_balance
DataSource
Value of asset held by Binance. Updated monthly. Available for BTC, ETH, SOL, USDT, and USDC.
buy_sell_volume
DataSource
Buy/sell volume from trade data.
cme_oi
DataSource
Open Interest for crypto futures contracts on the Chicago Mercantile Exchange. Only available for BTC and ETH.
deribit_implied_volatility
DataSource
Implied volatility of ticker on Deribit. Available only for BTC and ETH coins. Returns tenors of 1W, 1M, and 3M.
deribit_volatility_index
DataSource
Measure of implied or historical price volatility for a specific asset on Deribit. Limited to ETH and BTC coins. Returns OHLC data.
etf_flow
DataSource
Net inflow or outflow of capital into an ETF. Only available on 1D intervals.
etf_holding
DataSource
Asset balance held by major ETFs. Available for BTC, ETH, and SOL based ETFs.
etf_premium_rate
DataSource
Compares market price of an ETF with its net asset value (NAV). Available for BTC, ETH, and SOL based ETFs.
ethena_positions
DataSource
Amount of collateral within the Ethena protocol.
funding_rate
DataSource
Funding rate aggregation data from derivatives markets.
liquidations
DataSource
Liquidation aggregation data from derivatives markets.
long_short_ratio
DataSource
Overall ratio of long to short positions across all traders. Available for Binance, Bybit, and OKX.
ohlcv
DataSource
Open, High, Low, Close, Volume data from trade aggregations.
open_interest
DataSource
Open interest aggregation data from derivatives markets.
options_volume
DataSource
Puts and calls for a particular coin from Binance Options or Deribit based on volume. Limited to ETH and BTC coins.
options_open_interest
DataSource
Puts and calls for a particular coin from Binance Options or Deribit based on open interest. Limited to ETH and BTC coins.
orderbook
DataSource
Orderbook heatmap snapshot aggregation data.
skew
DataSource
Percentage difference in implied volatility between call and put options for a specific ticker on Deribit. Limited to BTC and ETH.
Function Categories
Explore technical indicators, mathematical functions, and utilities organized by category.