Systemicalpha

Square Root

systemic:core-sqrtMathfunction1 cr

Inputs

NameTypeDescription
DatafloatarrayThe numeric series to take the square root of.

Outputs

NameTypeDescription
SqrtfloatarrayThe principal square root of each input value.

x for x≥0\sqrt{x} \text{ for } x \geq 0

Computes the principal square root of each value. A compression tool that reduces the scale of extreme values while preserving order.

InputOutput
00
42
10010
10,000100

Input Constraint

⚠️ Important: Input values must be non-negative (≥ 0). Negative numbers have no real square root, so a negative input produces a null output at that position — the math is never faked with a substitute value.


The Compression Effect

Square root compresses large values more than small ones:

Original√ ResultCompression
111:1
1001010:1
10,000100100:1
1,000,0001,0001000:1

This makes data with extreme outliers (like volume or market cap) more manageable for comparison and analysis.


Practical Example: Volume Normalization

Trading volume varies by orders of magnitude across assets. Square root makes comparison meaningful:

Stock TypeRaw Volume√ Volume
Small-cap100,000316
Mid-cap1,000,0001,000
Large-cap100,000,00010,000

Now “2× average volume” has comparable significance across all asset sizes.


SQRT vs. POW(0.5)

Mathematically equivalent, but SQRT:

  • Enforces non-negative input constraint
  • Is semantically clearer for square root operations

Use POW with exponent 0.5 if you need more flexibility (e.g., variable exponents).


  • POW — General exponentiation (use exponent 2 to reverse SQRT)
  • ABS — Ensure non-negative input before SQRT
  • DIV — Alternative normalization (ratio-based)
TransformCompressionBest For
√xModerateVolume, counts, moderate outliers
log(x)StrongPrice ratios, returns, extreme outliers

Use square root when you want to reduce scale without completely flattening the data.


Missing Data

When an input position is missing (null) — for example, a stock series has no bar on a weekend or holiday — the output at that same position is null. Values are never invented to fill a gap: every non-null output is the true square root of a real datapoint.

In live mode, the module returns exactly one datapoint — the most recent position — and it may be null when no bar exists at that moment (e.g., a weekend tick on a market-hours series). That gap is correct, not an error.


Handling Negative Inputs

A negative value is a real datapoint whose square root simply does not exist — distinct from missing data, where no datapoint exists at all. Both surface as null in the output, but they mean different things:

  • Missing input → null: there was no bar to compute from
  • Negative input → null: there was a bar, but the math is undefined for it

If your data may contain negative values, pre-process with the ABS module to make inputs non-negative.


Quick Reference

InputOutput
00
11
42
93
2.251.5
1,000,0001,000
© 2026 WanoLabs. All rights reservedAlpha build v0.1.5