Indicator · Pine Script v5 · On the chart

First Passage Time - Distribution Analysis

by regalouisei

This indicator calculates first passage time distributions using Monte Carlo simulations based on historical log returns and volatility.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code415
Settings15inputs
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

First Passage Time - Distribution Analysis models the time required for price to reach configured percentage threshold targets above or below current market levels. The script runs simulations on the final bar, displaying risk zones, statistics, and customizable labels on the main price chart. Settings allow customization of simulation counts, lookback periods, drift modes, and visual styling.

Details

Published by

regalouisei on GitHub

Type

Indicator, Pine Script v5

Draws

On the price chart

Category

Volatility & bands, AI / machine learning

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
Threshold %float5.0threshold_pct
Volatility Lookback Periodint60volatility_period
Monte Carlo Simulationsint1000num_simulations
Show Risk Zonesbooltrueshow_zones
Show Chart Labelsbooltrueshow_labels
Distribution TypestringPercentiledistribution_type
Maximum Periods to Simulateint1000max_periods
Projection Barsint25projection_bars
Show Diagnosticsboolfalseshow_diagnostics
Drift ModestringHistoricaldrift_mode
Label SizestringNormallabel_size_option
Upside Label Colorcolorcolor.new(color.green, 10)label_upside_color
Show all 15 settings
SettingTypeDefaultVariable
Downside Label Colorcolorcolor.new(color.red, 10)label_downside_color
Label Text Colorcolorcolor.whitelabel_text_color
Table Font SizestringNormaltable_font_size
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

46 stars

This indicator uses a Hidden Markov Model (HMM) framework combined with an adaptive dual moving average engine and Directional Movement Index (DMI) features to identify market regimes (bullish, bearish, or ranging/chop). It calculates regime probabilities on e

Indicator v5 AI / machine learningTrend
Updated 7 weeks ago · None stated GitHub repository of HMM Enhanced: Regime Probability

This overlay indicator plots a SuperTrend-style band on the price chart using ATR length, a selectable source, and a base factor. Optional settings enable an adaptive factor driven by rate of change, a volatility filter, K-means clustering, and an LSTM layer w

Indicator v6 TrendVolatility & bands
Updated 4 months ago · MIT GitHub repository of ML SuperTrend (Ultimate) - Auto-Optimized AI with LSTM

Chandelier Flip Radar plots an ATR trailing stop on the price chart and tracks a directional trend state. It holds a ratchet stop until an accepted flip, using close or wick extremums and a body filter so weak breaks do not change direction. Distance to the fl

Indicator v6 TrendVolatility & bands
Updated yesterday · MIT GitHub repository of Chandelier Flip Radar [WavesUnchained]
7 stars

This overlay indicator draws Nadaraya-Watson smoothed Bollinger Bands on the price chart using short, medium, and long periods and deviations. A smoothing factor controls the kernel bandwidth, and an optional setting can allow the estimate to repaint. Users ca

Indicator v5 Volatility & bandsAI / machine learning
Updated 4 months ago · None stated GitHub repository of Bollinger Bands And EMA
3 stars

Farid Makram Custom Levels is a multi-signal indicator for TradingView that combines RSI momentum analysis with MOBO oscillator signals based on the DPO. It generates buy and sell signals when RSI crosses its moving average or when DPO crosses zero, with confi

Indicator v5 Oscillators & momentumMoving averages
Updated 5 months ago · None stated GitHub repository of Farid Makram Custom Levels

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers