Skip to main content

Module math

Module math 

Source
Available on crate feature math only.
Expand description

Math code spaces: one formula per line, compiled to Rust over columns.

# moving averages on the input bars, per symbol (group the input by symbol)
@title SMA cross
@show close, fast, slow
fast = sma(close, 10)
slow = sma(close, 30)
cross = if(fast > slow, 1, 0)
@update signal = cross

A name is an input field or an earlier line; every value is a column (one number per record, NaN when missing) computed per group of the input. See docs/code-spaces.md.

Structs§

Directives
Settings shared by math, Polars and Python sources (@name value lines).
Program
A parsed math source.

Enums§

Expr
An expression.

Functions§

functions
The function names (for help).
generate
The Rust user.rs for a math source, against the profile’s SDK.
parse
Parse a math source (lines name = formula, @directive …, # comment).
parse_expr
parse_for
parse with the profile’s help hint after an unknown function.