Log-space Bollinger Bands
Sep 1, 2017

The Log-space Bollinger Bands indicator provides a volatility envelope calculated using logarithmic transformations, making it highly effective for analyzing high-volatility assets and long-term growth trends. By performing calculations in log space and then converting the results back to linear values, it offers a more symmetrical representation of price movements relative to percentage changes.
Usage
The Log-space Bollinger Bands can be used similarly to standard Bollinger Bands but are specifically tailored for charts with significant price appreciation or volatility.
- Trend Identification: The basis (middle line) acts as a smoothed trend representative. Price staying consistently above or below the basis indicates a prevailing trend.
- Volatility Analysis: The width between the upper and lower bands expands and contracts based on logarithmic standard deviation.
- Mean Reversion: Traders may look for price rejections at the outer bands or crosses back through the basis as potential signals for mean reversion.
- High Volatility Assets: This tool is particularly useful for cryptocurrencies or stocks experiencing exponential growth, where traditional linear bands may appear distorted or lagged.
Details
Standard Bollinger Bands calculate the moving average and standard deviation directly on price. In contrast, this script applies a natural logarithm (math.log) to the source price before performing any calculations. This transforms the data into log space, where equal percentage changes are represented by equal distances. After calculating the basis and standard deviation bands in this log space, the script applies an exponential function (math.exp) to return the values to the price scale for overlaying on the chart. This ensures the bands remain proportional to the price action regardless of the absolute price level.
Settings
- Length: The lookback period used for the Simple Moving Average (basis) and the Standard Deviation calculation.
- StdDev: The multiplier for the logarithmic standard deviation to determine the distance of the upper and lower bands from the basis.
- Offset: Shifts the bands forward or backward on the horizontal axis.
- Source: The price data point used for the calculation (default is Close).
FAQ
How do I access the Log-space Bollinger Bands?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Why use log space instead of regular price?
Log space is superior for assets with large price swings because it treats a move from 10 to 20 the same as a move from 100 to 200, reflecting the identical 100% gain.
Can this indicator be used for alerts?
Yes, the script includes built-in alert conditions for price crossing the upper band, lower band, and the middle basis line.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.