title: % Change description: "% Change — Per-bar percentage change — (current − N bars ago) ÷ (N bars ago). Output is a fraction (e.g. 0.01 = +1%), NOT a percent. Multiply by 100 if you want percent units. First N bars emit NaN; division-by-zero (prior value was 0) emits NaN."
% Change¶
Math · Temporal
Per-bar percentage change — (current − N bars ago) ÷ (N bars ago). Output is a fraction (e.g. 0.01 = +1%), NOT a percent. Multiply by 100 if you want percent units. First N bars emit NaN; division-by-zero (prior value was 0) emits NaN.
% Change measures the percentage move of a series over N bars — (now − then) / then. Unlike Diff, which gives an absolute change in the series' own units, % Change gives a scale-free fraction, so a move is comparable whether price is 1.10 or 110. It's the natural way to express returns and to compare momentum across instruments at different price levels.
How it works¶
Each bar the block outputs (a − a.shift(bars)) / a.shift(bars) over the Lag (bars) look-back (default 1). The output is a fraction, not a percent — 0.01 means +1%, so multiply by 100 (via Scalar Math) if you want percent units. The first N bars emit NaN, and if the prior value was 0 (division by zero) that bar is NaN too.
When to use it¶
Use % Change to build returns and normalised momentum. A 1-bar % change is the bar's return; longer look-backs give multi-bar momentum on a comparable scale. It's the right tool when you're combining or comparing moves across instruments (a 2% move means the same thing everywhere, a 2-point move doesn't). Feed it into a Standardize for a z-scored return, or a Greater Than for a "moved more than X%" condition.
Example¶
A momentum threshold: apply % Change (5 bars) to price for the 5-bar return, then a Greater Than against 0.01 to flag "up more than 1% over 5 bars." Combine with a trend filter through an And gate into a Buy Signal and backtest in the Tester.
Tips & gotchas¶
- Output is a fraction — 0.01 = 1%. Multiply by 100 with Scalar Math for percent units.
- Scale-free — comparable across price levels and instruments, unlike Diff.
- First N bars + zero-prior-value → NaN.
- 1-bar % change = the bar's return — the basis of return-based analytics.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| In | series / bars |
Source series. BARS input uses close. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| % chg | series |
Line · sub-pane | Fractional change vs N bars ago. |
Parameters¶
| Parameter | Type | Default | What it does |
|---|---|---|---|
| Lag (bars) | number · 1–500 | 1 |
How many bars to look back. |
Reference auto-generated from the block catalog · category Math.