Multiply

Element-wiseCore Math

The Multiply node computes A × B element-wise, or scales an array by a constant multiplier. Fundamental for ATR-based stop/take-profit distances (price ± multiplier × ATR), percent-of-equity position sizing, indicator scaling, weighting signals in composite scoring, and modulating one series by another as a gating function.

Algorithm

  • Array × Array: output[i] = A[i] × B[i]
  • Array × Constant: output[i] = A[i] × numericB
  • Either operand null → null output

Parameters

NameTypeDefaultDescription
useNumericBbooleanfalseMultiply by a constant instead of a second array.
numericBnumber1The constant multiplier when useNumericB is enabled.

Inputs & Outputs

PortTypeDescription
Inputs
input1number[]Primary input array A
input2number[]Secondary input array B (ignored when useNumericB is true)
Outputs
valuesnumber | nullComputed value at each bar; null before the warmup period completes
timestampsnumber[]Bar timestamps (UNIX ms), aligned 1-to-1 with values
Live mode: In live streaming mode the node updates only the last bar in-place rather than recalculating the full array, keeping CPU usage minimal during real-time data feeds.

Use Cases

ATR Stop Bands

Multiply an ATR series by 2.5, then add/subtract from price to produce dynamic stop and target levels.

Weighted Scoring

Multiply two indicator signals together — when both agree (same sign and magnitude) the product is high; when they disagree it suppresses near zero.

Percent-of-Equity Sizing

Multiply a binary signal (0 or 1) by a constant risk fraction × account equity to compute target position notional.