Skip to content
StatePath
Tool Atlasmath.arithmetic

Tool

Arithmetic

math.arithmetic

MathArithmetic

Inputs

aBuffer (time series)

The first operand series.

bBuffer (time series)

The second operand series (used only by two-operand modes).

Outputs

Buffer (time series)

A number line carrying the result of the chosen operation, one value per bar.

Arithmetic is an all-in-one calculator node that runs one operation per bar on the series you wire in. A single `mode` picker switches it between basic math, single-value math, time shifting, rolling-window reductions, and normalization.

Arithmetic overview diagramab+a+b

How it works

Pick a `mode` and the inspector greys out the knobs that don't apply, then the node computes that operation on input `a` (and `b` for two-operand modes like add or divide), producing a float series. Window modes use `period`, shift uses `n`, and clamp uses `min`/`max`.

Modes

Addadd

Adds a and b on each bar.

Add diagramab+Add

When to use: Combine two series, e.g. sum two oscillators.

Subtractsub

Subtracts b from a.

Subtract diagramabSubtract

When to use: Spread between two lines, e.g. two MAs.

Multiplymul

Multiplies a by b.

Multiply diagramab×Multiply

When to use: Scale or weight one series by another.

Dividediv

Divides a by b.

Divide diagramab÷Divide

When to use: Ratios, e.g. price over a moving average.

Modulomod

Remainder of a divided by b.

Modulo diagramab%Modulo

When to use: Cyclic or periodic remainders.

Powerpow

Raises a to the power b.

Power diagramab^Power

When to use: Non-linear emphasis of a series.

Minimummin2

The smaller of a and b each bar.

Minimum diagramabmin2Minimum

When to use: Floor one series by another.

Maximummax2

The larger of a and b each bar.

Maximum diagramabmax2Maximum

When to use: Cap one series by another.

Absoluteabs

Absolute value of a.

Absolute diagramseriesabsseries

When to use: Size of a move ignoring its sign.

Square rootsqrt

Square root of a.

Square root diagramseriessqrtseries

When to use: Compress large values.

Exponentialexp

e raised to a.

Exponential diagramseriesexpseries

When to use: Exponential weighting.

Logarithmlog

Natural log of a.

Logarithm diagramserieslogseries

When to use: Compress exponential growth or log returns.

Negateneg

Flips the sign of a.

Negate diagramseriesnegseries

When to use: Invert a series.

Signsign

-1, 0, or +1 by the sign of a.

Sign diagramseriessignseries

When to use: Reduce a series to direction only.

Floorfloor

Rounds a down to an integer.

Floor diagramseriesfloorseries

When to use: Bucket values downward.

Ceilingceil

Rounds a up to an integer.

Ceiling diagramseriesceilseries

When to use: Bucket values upward.

Roundround

Rounds a to the nearest integer.

Round diagramseriesroundseries

When to use: Snap to whole values.

Shiftshift

Moves the series n bars in time.

Shift diagramshifted

When to use: Compare a value to its earlier self.

Rolling sumsum_window

Sum over the last `period` bars.

Rolling sum diagram

When to use: Cumulative flow over a window.

Rolling meanmean_window

Average over the last `period` bars.

Rolling mean diagram

When to use: Smooth a series.

Rolling minmin_window

Lowest value in the last `period` bars.

Rolling min diagram

When to use: Recent support / lowest low.

Rolling maxmax_window

Highest value in the last `period` bars.

Rolling max diagram

When to use: Recent resistance / highest high.

Normalizenormalize

Rescales the window to 0–1.

Normalize diagram

When to use: Put a series on a fixed scale.

Z-scorez_score

Standard deviations from the window mean.

Z-score diagram

When to use: Detect statistical extremes.

Percentile rankpercentile_rank

Where the latest value sits in the window (0–1).

Percentile rank diagram

When to use: Relative strength within a window.

Clampclamp

Pins the value between min and max.

Clamp diagram

When to use: Bound a series to a safe range.

Configuration

modeenum

Which operation to run: basic math (add, sub, mul, div, mod, pow, min2, max2), single-value math (abs, sqrt, exp, log, neg, sign, floor, ceil, round), time shift (shift), rolling-window reductions (sum_window, mean_window, min_window, max_window), or normalization (normalize, z_score, percentile_rank, clamp).

Choices:addsubmuldivmodpowmin2max2abssqrtexplognegsignfloorceilroundshiftsum_windowmean_windowmin_windowmax_windownormalizez_scorepercentile_rankclamp
nscalar

Bars to shift when mode is shift — positive looks back, negative looks ahead (the look-ahead case is flagged repainting).

n diagramshifted
periodscalar

How many bars the rolling window covers, used by the window and normalization modes.

period diagram
minscalar

The lower bound the value is pinned to when mode is clamp.

maxscalar

The upper bound the value is pinned to when mode is clamp.

Connects to

Reads from
Feeds into

Examples

  • Set mode to sub and wire two moving averages into a and b to output the spread between them as a signal source.
  • Set mode to z_score with a 20-bar period to turn a raw series into a normalized score you can threshold.

Common mistakes

  • Using a binary mode like div but only wiring input a, leaving the second operand unset.
  • Choosing a backward shift (negative n) and not realising it peeks at future bars — that mode is flagged repainting and can leak look-ahead bias.

See also