log_return: Lognormal Return
Calculates continuously compounded logarithmic return over N bars.
@log_return(close, 21) > 0.05 Key Takeaways
- Time-additive property makes multi-period compounding math straightforward.
- Eliminates upward compounding distortion inherent in simple arithmetic returns.
- Standard input for volatility and momentum calculations.
What It Means in Simple Terms
Lognormal return measures the percentage growth of an investment in continuously compounded terms. Unlike simple percentage returns, log returns are mathematically symmetric: a +10% move followed by a -10% move adds up cleanly to 0 in log space, making long-term performance comparisons accurate.
How It Helps You as an Investor
It gives you a clean, scale-independent way to rank stocks by performance over any arbitrary window (e.g. 1 month, 6 months, 1 year).
Visual Node Rule Syntax & How to Plug in Values
@log_return(close, 21) > 0.05 Parameter Tuning & Market Calibration
Set the parameter $n$ to match your evaluation window. For a 1-month gain filter, use `@log_return(close, 21) > 0.05` (stock gained > 5% in log terms). For 1-quarter momentum, use 63 days.
Input Fields & Parameters
| Field / Parameter | Type | Default | Role & Description |
|---|---|---|---|
field | field | Required | Historical input price or volume series from market feed. |
timeperiod | int | 1 | Lookback period or tuning parameter for market calibration. |
Mathematical Formulation
The mathematical definition of log_return (Lognormal Return) as evaluated within the Saral Engine execution pipeline:
Variable & Parameter Definitions
$P_t$ is current close and $P_{t-n}$ is close $n$ periods ago. Negative or zero prices are automatically masked to NaN.
Systematic Strategy Applications
@log_return(close, 21) > 0.05 Require that the stock has gained at least 5% in log terms over the last 21 trading days.
Common Questions & Practical Considerations
How do log returns compare to standard percentage returns?
For small daily price changes (e.g. +1%), log return and simple percentage return are almost identical. Over large moves (+50%), log returns are slightly smaller due to continuous compounding.