This page lists every built-in value, function and keyword of WickScript version 1, generated from the language itself, so it always matches what the checker accepts. Units are those described in the Language guide; many functions return the unit of their source, so the EMA of a price is a price and the EMA of a volume is a volume. Lengths are fixed whole numbers of at least 1 – a number, N bars or an input.
#Candle and price
| Name | Kind | Unit | Description |
|---|
open | series | price | Open of the candle |
high | series | price | High of the candle |
low | series | price | Low of the candle |
close | series | price | Close of the candle |
hl2 | series | price | (high + low) / 2 |
hlc3 | series | price | (high + low + close) / 3 |
ohlc4 | series | price | (open + high + low + close) / 4 |
volume | series | amount | Volume of the candle |
truerange | series | price | True range of the candle |
vwap | series | price | Volume-weighted average price of the UTC day (from open, high, low, close) |
obv | series | amount | On-balance volume |
tick | constant | price | Smallest price step of the market |
#Time and sessions
| Name | Kind | Unit | Description |
|---|
time | series | time | Open time of the candle |
session | series | text | Trading session of the candle: Asia, London or NewYork |
Asia | constant | text | Asia session |
London | constant | text | London session |
NewYork | constant | text | New York session (or killzone) |
LondonClose | constant | text | London close killzone |
killzone | series | text | ICT killzone of the candle (New York time): Asia 20–24, London 2–5, NewYork 7–10, LondonClose 10–12 |
hour | series | number | Hour of the candle's open time (UTC, 0 … 23) |
minute | series | number | Minute of the candle's open time (0 … 59) |
weekday | series | text | Weekday of the candle (UTC): Monday … Sunday |
date | series | text | Date of the candle (UTC) as text, e.g. "2026-10-24" |
Monday | constant | text | Monday |
Tuesday | constant | text | Tuesday |
Wednesday | constant | text | Wednesday |
Thursday | constant | text | Thursday |
Friday | constant | text | Friday |
Saturday | constant | text | Saturday |
Sunday | constant | text | Sunday |
#Orderflow (from ticks)
| Name | Kind | Unit | Description |
|---|
buyVolume | series | amount | Aggressive buy volume of the candle (from ticks; na without tick data) |
sellVolume | series | amount | Aggressive sell volume of the candle (from ticks; na without tick data) |
delta | series | amount | Buy volume − sell volume of the candle (from ticks) |
cvd | series | amount | Cumulative delta since the first candle with tick data |
trades | series | number | Number of trades (ticks) in the candle |
#Order book fields
The order book at the candle's close, where it was recorded (available(book) tells you).
| Field | Unit |
|---|
book.bid | price |
book.ask | price |
book.spread | price |
book.mid | price |
book.available | true/false |
The footprint of each candle, built from its ticks.
| Field | Unit |
|---|
footprint.poc | price |
footprint.vah | price |
footprint.val | price |
footprint.buyImbalances | number |
footprint.sellImbalances | number |
footprint.imbalance | number |
#Trade fields (inside on tick … end)
One trade (tick) of the market.
| Field | Unit |
|---|
trade.price | price |
trade.size | amount |
trade.side | text |
trade.buy | true/false |
trade.sell | true/false |
trade.time | time |
#Position fields (strategies)
The open trade of a strategy script.
| Field | Unit |
|---|
position.open | true/false |
position.long | true/false |
position.short | true/false |
position.entry | price |
position.stop | price |
position.target | price |
position.size | percent |
position.r | R |
position.bars | bars |
#Functions
Lengths are constants – a number, an input or N bars – so scripts stay incremental and fast. “Unit of the input” means the result keeps the unit of the series you pass in (the EMA of a price is a price).
#Moving averages and windows
| Function | Returns | Description |
|---|
sma(source: value, length: length) | unit of the input | Simple moving average |
ema(source: value, length: length) | unit of the input | Exponential moving average |
rma(source: value, length: length) | unit of the input | Running moving average (Wilder) |
wma(source: value, length: length) | unit of the input | Weighted moving average |
dema(source: value, length: length) | unit of the input | Double exponential moving average |
stdev(source: value, length: length) | unit of the input | Standard deviation |
highest(source: value, length: length) | unit of the input | Highest value of the last candles |
lowest(source: value, length: length) | unit of the input | Lowest value of the last candles |
sum(source: value, length: length) | unit of the input | Sum of the last candles |
change(source: value, length?: length) | unit of the input | Change against N candles ago (default 1) |
#Indicators
| Function | Returns | Description |
|---|
rsi(source: value, length: length) | number | Relative strength index (0 … 100) |
atr(length: length) | price | Average true range (Wilder) |
mfi(length: length) | number | Money flow index (0 … 100) |
chop(length: length) | number | Choppiness index (0 … 100) |
vwap(anchor?: text, amount?: length) | price | VWAP that restarts every anchor: "minute", "hour", "day", "week", "month" (UTC, × amount) or "session" (Asia, London, New York) |
macd(source: value, fast: length, slow: length, signal: length) | record line, signal, histogram (unit of the input) | MACD line, signal and histogram |
stoch(length: length, smoothK: length, smoothD: length) | record k (number), d (number) | Stochastic %K and %D (0 … 100) |
#Conditions
| Function | Returns | Description |
|---|
crossover(a: value, b: value) | true/false | a crosses above b (same as “a crosses above b”) |
crossunder(a: value, b: value) | true/false | a crosses below b |
available(data: any) | true/false | available(book): is there orderbook data at this candle? |
isna(x: any) | true/false | True where x has no value (na), e.g. while an indicator warms up |
#Order book
| Function | Returns | Description |
|---|
book.bidPrice(level: length) | price | Price of the n-th bid level (1 … 10) at the candle's close |
book.askPrice(level: length) | price | Price of the n-th ask level (1 … 10) at the candle's close |
book.bidSize(level: length) | amount | Size of the n-th bid level (1 … 10) |
book.askSize(level: length) | amount | Size of the n-th ask level (1 … 10) |
book.bidVolume(depth: length) | amount | Size of the best 5, 10, 25 or 50 bid levels |
book.askVolume(depth: length) | amount | Size of the best 5, 10, 25 or 50 ask levels |
book.imbalance(depth: length) | number | (bid − ask) / (bid + ask) over the best 5, 10, 25 or 50 levels (−1 … 1) |
#Math and units
| Function | Returns | Description |
|---|
abs(x: value) | unit of the input | Absolute value |
min(a: value, b: value) | unit of the input | Smaller of two values |
max(a: value, b: value) | unit of the input | Larger of two values |
round(x: value) | unit of the input | Round to a whole number |
nz(x: value, replacement?: value) | unit of the input | Replace na (default 0) |
sqrt(x: number) | number | Square root |
log(x: number) | number | Natural logarithm |
pow(x: number, y: number) | number | x to the power of y |
pct(now: price, before: price) | percent | Change from before to now in % |
number(x: any) | number | Drop the unit – calculate with plain numbers on purpose |
price(x: number) | price | A fixed price level, e.g. price(2000) |
amount(x: number) | amount | A fixed amount (volume), e.g. trade.size >= amount(50) |
#Colors
white (#f0efec), black (#000000), gray (#9ca3af), red (#ef4444), green (#22c55e), blue (#3987e5), amber (#f59e0b), orange (#f97316), yellow (#facc15), lime (#84cc16), teal (#14b8a6), cyan (#22d3ee), purple (#a855f7), violet (#a78bfa), pink (#f472b6). Any #RRGGBB value works as well.
#Reserved words
These words carry the sentence structure and can't be used as names: alert, and, as, becomes, crosses, define, else, end, falling, false, if, indicator, input, is, keep, library, mark, mod, na, not, of, on, or, repeat, return, rising, show, strategy, then, true, use, when, wickscript.