Log Return¶
Math · Temporal
Per-bar log return — ln(current ÷ prior bar). The statistically correct return for comparing/normalising across assets and for compounding. First bar and non-positive ratios emit NaN.
Log Return gives the per-bar logarithmic return of a series — the natural log of this bar divided by the last. It's the statistically "correct" return: log returns add up cleanly over time and are comparable across instruments of very different price, which is why quant work uses them over plain percent change.
How it works¶
Each bar the output is ln(current ÷ prior). The first bar has no prior, so it emits NaN, as does any bar where the ratio is non-positive (you can't take the log of zero or a negative). Over multiple bars, log returns are additive — summing them equals the log of the total growth — which makes them ideal for compounding and aggregation. Lookahead-free, no parameters.
When to use it¶
Use it whenever you're doing return-based maths: measuring volatility as the stdev of log returns, comparing momentum across assets on a common footing, or feeding a normalised return into a score. It's the honest input for anything statistical, and it plays well with Cumulative Sum for building a log-equity curve.
Example¶
Return volatility: wire close into Log Return, then into Rolling Stdev (window = 20) to get annualisable, scale-free volatility you can compare across symbols — a cleaner regime input than raw ATR when you're mixing instruments.
Tips & gotchas¶
- Additive over time — sum them for total log-growth (pairs with Cumulative Sum).
- First bar + non-positive ratios → NaN.
- Tiny numbers — log returns are small; you'll usually scale them before display.
- For a plain human-readable percent, use Percent Change 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 |
|---|---|---|---|
| log ret | series |
Line · sub-pane | ln(a / a[-1]). |
Reference auto-generated from the block catalog · category Math.