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
| Name | Type | Default | Description |
|---|---|---|---|
| useNumericB | boolean | false | Multiply by a constant instead of a second array. |
| numericB | number | 1 | The constant multiplier when useNumericB is enabled. |
Inputs & Outputs
| Port | Type | Description |
|---|---|---|
| Inputs | ||
| input1 | number[] | Primary input array A |
| input2 | number[] | Secondary input array B (ignored when useNumericB is true) |
| Outputs | ||
| values | number | null | Computed value at each bar; null before the warmup period completes |
| timestamps | number[] | 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.