OPEN-SOURCE SCRIPT
Log Return Distribution

This indicator calculates the statistical distribution of logarithmic returns over a user-defined lookback period and visualizes it as a horizontal profile anchored to the most recent opening price.
- Lookback Length: The number of recent bars to include in the distribution analysis. A larger value (e.g., 252) provides a long-term statistical view, while a smaller value (e.g., 20) focuses on recent, short-term volatility.
- Bins Count: The number of price levels to divide the distribution into. An odd number is recommended (e.g., 31, 51) to ensure a dedicated central line for the 0% return.
- Max Line Length: The horizontal length (in bars) of the line representing the most frequent return bin (the mode). This setting scales the entire profile, allowing you to make differences in frequency more or less pronounced visually.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.