Math Operators
12 functions.
pta.add
Vector Arithmetic Add
pta.add(real0, real1)
TA-Lib name: ADD
Inputs
| Input | Default |
|---|---|
real0 |
required |
real1 |
required |
Parameters
None.
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.add(pl.col("close"), pl.col("open")).alias("add"))
pta.cumsum
Cumulative Sum
pta.cumsum(real=pl.col("close"))
TA-Lib name: CUMSUM
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
None.
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.cumsum().alias("cumsum"))
pta.div
Vector Arithmetic Div
pta.div(real0, real1)
TA-Lib name: DIV
Inputs
| Input | Default |
|---|---|
real0 |
required |
real1 |
required |
Parameters
None.
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.div(pl.col("close"), pl.col("open")).alias("div"))
pta.max
Highest value over a specified period
pta.max(real=pl.col("close"), time_period=30)
TA-Lib name: MAX
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.max(time_period=20).alias("max"))
pta.maxindex
Index of highest value over a specified period
pta.maxindex(real=pl.col("close"), time_period=30)
TA-Lib name: MAXINDEX
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
integer |
Int32 |
Example
df.select(pta.maxindex(time_period=20).alias("maxindex"))
pta.min
Lowest value over a specified period
pta.min(real=pl.col("close"), time_period=30)
TA-Lib name: MIN
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.min(time_period=20).alias("min"))
pta.minindex
Index of lowest value over a specified period
pta.minindex(real=pl.col("close"), time_period=30)
TA-Lib name: MININDEX
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
integer |
Int32 |
Example
df.select(pta.minindex(time_period=20).alias("minindex"))
pta.minmax
Lowest and highest values over a specified period
pta.minmax(real=pl.col("close"), time_period=30)
TA-Lib name: MINMAX
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
min |
Float64 |
max |
Float64 |
Returned as a Struct.
Example
df.select(pta.minmax(time_period=20).alias("out")).unnest("out")
pta.minmaxindex
Indexes of lowest and highest values over a specified period
pta.minmaxindex(real=pl.col("close"), time_period=30)
TA-Lib name: MINMAXINDEX
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
min_idx |
Int32 |
max_idx |
Int32 |
Returned as a Struct.
Example
df.select(pta.minmaxindex(time_period=20).alias("out")).unnest("out")
pta.mult
Vector Arithmetic Mult
pta.mult(real0, real1)
TA-Lib name: MULT
Inputs
| Input | Default |
|---|---|
real0 |
required |
real1 |
required |
Parameters
None.
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.mult(pl.col("close"), pl.col("open")).alias("mult"))
pta.sub
Vector Arithmetic Subtraction
pta.sub(real0, real1)
TA-Lib name: SUB
Inputs
| Input | Default |
|---|---|
real0 |
required |
real1 |
required |
Parameters
None.
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.sub(pl.col("close"), pl.col("open")).alias("sub"))
pta.sum
Summation
pta.sum(real=pl.col("close"), time_period=30)
TA-Lib name: SUM
Inputs
| Input | Default |
|---|---|
real |
pl.col("close") |
Parameters
| Parameter | TA-Lib name | Type | Default | Range / values |
|---|---|---|---|---|
time_period |
optInTimePeriod |
int | 30 | 2 .. 100000 |
Outputs
| Field | dtype |
|---|---|
real |
Float64 |
Example
df.select(pta.sum(time_period=20).alias("sum"))