Skip to content

Lab

Your own formulas on real data, a Python notebook in the browser and the public REST API.

VX formula language

Range

Another instrument's close in quotes: "^GSPC". A comparison makes it a yes/no condition (for alerts).

^FTSE · close / SMA(close, 50) - 1

Formulas are descriptive calculations on past data – not forecasts and not signals.

Functions

close · open · high · low · volume · "SYMBOL"
Fields of the main instrument; a quoted symbol = another instrument's close.
SMA(x, n)
Average of the last n values.
EMA(x, n)
Exponential moving average (recent values weigh more).
RSI(x, n = 14)
Relative strength index between 0 and 100 (Wilder smoothing).
STD(x, n)
Standard deviation over the last n values.
MAX(x, n)
Highest of the last n values.
MIN(x, n)
Lowest of the last n values.
SUM(x, n)
Sum of the last n values.
PCT(x, n = 1)
Change in percent over n periods.
REF(x, n = 1)
The value n periods ago.
DIFF(x, n = 1)
Difference from the value n periods ago.
ZSCORE(x, n)
How many standard deviations the latest value is from the n-period average.
CORR(a, b, n)
Correlation of two series over the last n periods (−1…+1).
DRAWDOWN(x)
How far the value is below its running peak (%).
CROSSUP(a, b)
1 on the day a crosses above b, otherwise 0.
CROSSDOWN(a, b)
1 on the day a crosses below b, otherwise 0.
ABS(x)
Absolute value.
LOG(x)
Natural logarithm.
SQRT(x)
Square root.
ROUND(x, d = 0)
Round to d decimals.
IF(condition, a, b)
a where the condition holds, otherwise b.
+ − * / ^ · > < >= <= == != · AND OR NOT
Arithmetic, comparisons (1 = true, 0 = false), logic.

Informational data, not investment advice.