OPEN-SOURCE SCRIPT

ATR-Normalized Monte Carlo PRO

448
ATR-Normalized Monte Carlo PRO is a probabilistic forecasting tool designed to estimate a range of possible future price paths using the asset’s own historical behavior normalized by Average True Range (ATR).

Instead of assuming that returns follow a theoretical normal distribution, the script builds an empirical sample of historical price movements expressed in ATR units. These normalized movements are then randomly resampled to generate multiple forward price paths.
The objective is not to predict an exact future price, but to estimate the distribution of possible outcomes over a configurable forecast horizon.

How the model works

For each historical bar, the script calculates an ATR-normalized close-to-close movement:
Normalized Move = (Current Close - Previous Close) / Previous ATR
This transforms historical price changes into comparable volatility-adjusted units.
The Monte Carlo engine then randomly samples these historical ATR-normalized movements and applies them to the current ATR environment to generate multiple simulated price paths.
For each future step, the script calculates the following distribution percentiles:
• P05 — lower 5th percentile
• P25 — lower quartile
• P50 — median simulated outcome
• P75 — upper quartile
• P95 — upper 5th-percentile boundary

These levels form a forward probability envelope around the current price.

Forecast horizon
The forecast can be defined in two ways:

Sessions
The script estimates the average number of chart bars per trading session using recent historical sessions and converts the selected number of sessions into forecast bars automatically.

Bars
The user can directly specify the number of future bars to simulate.

This allows the model to adapt to intraday and higher-timeframe charts without requiring a fixed number of bars per session.

ATR risk units
The script includes four methods for defining the Target and Stop risk unit:

Bar ATR
Uses the current chart ATR directly.

Session ATR
Scales the current ATR by the square root of the estimated number of bars per session:

Session ATR = ATR × sqrt(Bars per Session)
This is the default setting.

Horizon ATR
Scales ATR across the entire forecast horizon:

Horizon ATR = ATR × sqrt(Forecast Bars)
Manual Scale

Allows the user to define a custom ATR scaling factor.
Target and Stop levels are then calculated as multiples of the selected risk unit.

Example:
Target = +3.0 Session ATR
Stop = -1.0 Session ATR
This corresponds to a theoretical 1:3 risk-to-reward structure.
Probability metrics
The dashboard displays several Monte Carlo-derived probabilities:
P(Close > Current)
Percentage of simulated paths whose terminal price finishes above the current market price.
P(Target First)
Percentage of simulations that reach the selected Target before reaching the Stop.
P(Stop First)
Percentage of simulations that reach the Stop before reaching the Target.
P(Unresolved)
Percentage of simulations that reach neither level within the selected forecast horizon.
These metrics distinguish directional probability from the probability of completing a specific trade structure.

Dynamic Probability Bias
The script classifies the current simulation distribution into five configurable states:
• Strong Bullish
• Bullish
• Neutral
• Bearish
• Strong Bearish

By default, the classification is based on the percentage of simulated terminal prices finishing above the current price.
The thresholds are user-configurable.
The Probability Bias is therefore dynamic and may change as price, ATR, historical normalized movements, and the forecast horizon change.
It should be interpreted as a summary of the current Monte Carlo distribution, not as a trading signal.

Dashboard
The configurable dashboard includes:
• Current timeframe
• ATR value and ATR percentage
• Historical sample size
• Number of simulations
• Forecast mode
• Estimated bars per session
• Forecast bars
• Base ATR
• Session ATR
• Horizon ATR
• Selected risk-unit mode
• P05 / P25 / P50 / P75 / P95
• Probability of closing above current price
• Target-first probability
• Stop-first probability
• Unresolved probability
• Target / Stop structure
• Risk-to-reward ratio
• Dynamic Probability Bias

The dashboard position, text size, colors, borders, and left/right column alignment can be customized.

How to use it
A practical workflow is:
1. Select the chart timeframe.
2. Choose the historical lookback.
3. Select the number of Monte Carlo simulations.
4. Define the forecast horizon in sessions or bars.
5. Select the ATR risk-unit method.
6. Define Target and Stop multiples.
7. Evaluate the percentile envelope together with the probability metrics.
For example, a bullish Probability Bias does not necessarily imply a high probability of reaching a +3 ATR Target. The script intentionally separates directional probability from Target/Stop feasibility.

Originality and purpose

This script combines three concepts into one framework:
• empirical Monte Carlo resampling,
• ATR-normalized historical price movement,
• session-aware forecast and risk scaling.

Rather than applying a fixed theoretical return distribution, the simulation uses the instrument’s own recent volatility-adjusted historical behavior.
The purpose is to provide a probabilistic framework for scenario analysis, volatility-aware risk assessment, and trade planning.
Important limitations

Monte Carlo simulation does not predict future market prices.
The model assumes that historical ATR-normalized movements are relevant to future scenarios. Market structure, volatility regimes, gaps, liquidity conditions, news events, and structural changes may cause future behavior to differ materially from the historical sample.
The current implementation also resamples individual historical movements independently. It therefore does not fully preserve serial correlation, volatility clustering, or multi-bar market regimes.

Target and Stop probabilities are simulated estimates and should not be interpreted as guaranteed probabilities of future execution.
Results may also vary as the latest bar, ATR, historical sample, and simulation draws change.
Use standard price charts when evaluating the script. Non-standard chart types can materially alter the underlying price series and produce misleading interpretations.
Disclaimer

This script is provided for educational and analytical purposes only.
It does not provide financial advice, investment recommendations, trade signals, or guarantees of profitability.

Monte Carlo simulations, probability estimates, percentile projections, and hypothetical scenarios are based on historical data and assumptions. They do not guarantee future results.
Trading and investing involve risk, including the possible loss of capital. Users are responsible for their own analysis, risk management, and trading decisions.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.