DocsMathStatisticsRMS (Root Mean Square)

RMS (Root Mean Square)

Windowed · default period 20Statistics

The Root Mean Square node computes √(mean(x²)) over the rolling window. RMS measures the "energy" or average magnitude of a signal — it is always non-negative and equals the standard deviation when the mean is exactly zero. RMS is useful for measuring oscillator amplitude, signal strength, and the average absolute magnitude of returns without sign cancellation.

Algorithm

  • vals = non-null values in window
  • RMS = √(Σ v² / n)
  • Returns null when no non-null values exist

Parameters

NameTypeDefaultDescription
periodnumber20Rolling window size.

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

Oscillator Amplitude

Apply RMS to a centered oscillator (e.g., MACD, price − SMA) to measure its average energy. High RMS indicates active oscillation; low RMS indicates quiet, compressing conditions.

Return Magnitude

RMS of returns gives the average absolute magnitude of moves, useful when you want to ignore direction but capture the intensity of market activity.

Signal Strength Thresholding

Only trade when RMS of the entry signal exceeds a minimum threshold — a signal with low RMS suggests weak conviction in the indicator.