Indicator · Pine Script v5 · Own pane

Probability Distribution Histogram

by regalouisei· code credited to Anton Berlin, 2022

This indicator calculates and displays the empirical probability distribution of transformed market data alongside theoretical distributions in a separate pane.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code1,019
Settings22inputs
LicenceNone stated
Last update8 months ago25 Feb 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

Probability Distribution Histogram compares empirical bar frequencies against theoretical models like normal or Laplace distributions. Users can configure data transformation methods, custom bin counts and widths, top and bottom trimming, and historical lookback windows or specific date ranges. The tool also provides visual highlighting for the bin containing the current price point and calculates statistical metrics including sample moments, quantiles, and spread.

Details

Published by

regalouisei on GitHub

Code credit

Anton Berlin, 2022, as written in the script's header

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Input Data to Plotsourceclosesrc
Data Transformation MethodstringTRANSFORM_LOG_PERC_CHANGEdata_transform_method
% to Trim from the TOP of the Data [0 to 100]float0trim_from_top
% to Trim from the BOTTOM of the Data [0 to 100]float0trim_from_bottom
Lookback Window [0 = All Chart Data]int0lookback_window
Only Use Data From Below Date/Time Rangeboolfalseuse_date_time_range
Start Date/Timetimetimestamp("2021-01-01 00:00:00")time_start
End Date/Timetimetimestamp("2022-12-31 00:00:00")time_end
Number of Bins [1 to 50]int30bins
Custom Bin Widthfloat0custom_bin_width
Bar Resolution [1 to 50]int50Bar Resolution [1 to 50]
Height (% of Panel) [33 to 100]float60row_height
Show all 22 settings
SettingTypeDefaultVariable
Base Colorcolorcolor.whiteclr_hist
Empirical Distribution Bar Colorcolorcolor.new(color.blue, transp = 10)clr_distr_bar
Theoretical Distribution for ComparisonstringDISTR_NORMtheoretical_distr
Theoretical Distribution Bar Colorcolorcolor.rgb(63, 63, 63, transp = 10)clr_theoretical_bar
Top Row X-Axis Label Color - Positive Valuescolorcolor.rgb(155, 255, 135, transp = 0)clr_lbl_pos_num
Top Row X-Axis Label Color - Negative Valuescolorcolor.rgb(255, 155, 135, transp = 0)clr_lbl_neg_num
Font Sizestringsize.tinyfont_size
Top Row X-Axis Label Precision [0 to 10]int4top_row_precision
Highlight Bin for Current Data Point?booltruehighlight_cur_bin
Highlighted Bin Colorcolorcolor.new(color.yellow, transp = 10)clr_highlight_cur_bin
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This indicator calculates the distribution of close-to-close percentage changes using rate of change on closing prices. It bins percentage changes into intervals of 0.25 percent increments from negative to positive values and plots a normalized cumulative hist

Indicator v4 Volatility & bands
Updated 12 days ago · GPL-3.0 GitHub repository of Close-to-Close % Change Distribution

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper
330 stars

This indicator plots candle range and open-to-close movement as percentages in a separate pane. Range is the high-low difference divided by the low, and change is the close-open difference divided by the open. Both series draw as columns. Teal columns show ran

Indicator v5 Volatility & bands
Updated 2 months ago · None stated GitHub repository of Percent & Volatility [Alorse]

Mojito v3 Strategy

by namuan
318 stars

The Mojito v3 Strategy indicator evaluates volatility term structure by calculating the ratio between front-month and second-month VIX futures contracts. It smooths this ratio using a configurable median filter and compares the result against user-defined uppe

Indicator v5 Volatility & bands
Updated 2 months ago · MIT GitHub repository of Mojito v3 Strategy

Function - Logistic Equation

by ricardosantos79
261 stars

Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of Function - Logistic Equation
228 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector

More Volatility & bands scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers