Cumulative Product¶
Math · Temporal
Running product from the first bar — e.g. compound a series of growth factors (1 + return) into an equity multiple. NaN values count as 1 (identity), so a gap doesn't zero everything after it.
Cumulative Product multiplies a series together from the very first bar onward — each bar's output is the running product of everything up to it. Its headline use is compounding: feed it a series of growth factors like 1 + return and it builds an equity multiple, turning per-bar returns into a total-growth curve.
How it works¶
Each bar the output is the previous product times the current value. Crucially, NaN values are treated as 1 (the multiplicative identity), so a single missing bar doesn't zero out everything after it — the curve simply carries through the gap. It runs from the first bar and never resets. Lookahead-free, no parameters.
When to use it¶
Use it to compound anything multiplicative: build a strategy or buy-and-hold equity multiple from 1 + return factors, accumulate a decay/growth factor, or chain probabilities. It's the multiplicative twin of Cumulative Sum — reach for sum when things add (log returns, counts) and product when they compound (simple returns).
Example¶
Equity multiple: take per-bar simple returns, Add a Constant of 1 to get growth factors, then Cumulative Product them — the output is your compounded equity curve starting from 1.0 (a value of 1.5 means +50% total).
Tips & gotchas¶
- NaN counts as 1 — gaps carry through instead of destroying the running product.
- A single 0 pins the product to 0 thereafter — that's correct compounding (a −100% bar wipes you out), so mind your inputs.
- Runs from bar 1, no reset — for a windowed product, that's out of scope; sum in log-space instead.
Related blocks¶
Inputs¶
| Socket | Type | What to wire in |
|---|---|---|
| In | series / bars |
Source series. BARS input uses close. |
Outputs¶
| Output | Type | Plots as | Description |
|---|---|---|---|
| ∏ | series |
Line · sub-pane | Running cumulative product. |
Reference auto-generated from the block catalog · category Math.