Rolling Mean¶
Math · Rolling
Simple moving average of the trailing N bars — the mean of any series, not just price (smooth an RSI, an ATR, a spread, etc.).
Rolling Mean is a simple moving average that works on any series, not just price. Feed it an RSI, an ATR, a spread, a custom score — anything — and it hands back the average of the last N bars. It's the go-to smoother when you want to take the jitter out of a derived signal before you make a decision on it.
How it works¶
Each bar the block averages the trailing window values of its input (the current bar plus the N−1 before it). It's a plain arithmetic mean — every bar in the window counts equally — computed lookahead-free, so a bar never sees the future. During the first window − 1 bars there aren't enough values yet, so the output is NaN ("no value") until the window fills.
When to use it¶
Reach for it whenever a raw series is too noisy to act on directly: smooth an oscillator before a crossover, average an ATR to get a steadier volatility read, or take the mean of a composite score. Because it accepts any input, it's the generic "SMA of X" you'd otherwise have to fake. For price specifically, the dedicated SMA is more discoverable, but the maths is identical.
Example¶
Smooth a choppy oscillator: wire an RSI into Rolling Mean with window = 5, then compare the smoothed line to 50 with GreaterThan — you get a cleaner momentum-regime flag with far fewer whipsaws than the raw RSI. Backtest it in the Tester.
Tips & gotchas¶
- Any series in — RSI, ATR, spreads, scores — not just price.
- Longer window = smoother but laggier. More smoothing always costs responsiveness.
- First
window − 1bars are NaN — the engine reads that as no value, so downstream signals won't fire during warmup. - Equal-weighted — every bar counts the same. For a recency-weighted smooth, use EMA Smooth.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| In | series / bars |
Source series. BARS input uses close. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| mean | series |
Line · sub-pane | Per-bar rolling mean. |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Window (bars) | number · 2–500 | 14 |
Bars in the rolling window. |
Reference auto-generated from the block catalog · category Math.