Power

Element-wiseCore Math

The Power node raises each element x to the exponent p (Math.pow(x, p)). Default is p=2 (squaring). Used to compute squared deviations (the first step of variance), apply polynomial transformations to signals, create quadratic scaling for penalty functions, and implement any indicator that requires raising values to arbitrary powers.

Algorithm

  • output[i] = Math.pow(input[i], p)
  • null inputs → null output

Parameters

NameTypeDefaultDescription
pnumber2Exponent. Defaults to 2 (squaring). Use 0.5 for square root, negative values for reciprocals.

Inputs & Outputs

PortTypeDescription
Inputs
inputnumber[]Source numeric array
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

Variance From Scratch

Subtract the mean from a price series (Subtract + Average), then Pow with p=2, then Average again — this produces the exact population variance without a dedicated node.

Penalty Scaling

Apply Pow(p=2) to a drawdown series to give quadratic penalty weight to larger drawdowns in a composite risk score.

Square Root via Pow

Set p=0.5 as an alternative to the dedicated Sqrt node — identical results, useful when you already have a Pow node in the pipeline.