Skip to content
All library documents

Sampling Historical Returns to Visualize Monte Carlo Price Paths

Article TradingView scripts

Summary

This indicator generates forward price paths by repeatedly sampling from a recent history of logarithmic returns. For each simulated step, it adds an estimated drift adjustment based on the average and variance of those returns, then compounds the result from the current close. The display draws a subset of individual random walks alongside stepwise minimum and maximum closing paths across all simulations. Users can set the forecast horizon, simulation count, and historical sample length, and optionally retain earlier min-max plots.

The script illustrates a scenario-generation technique rather than a directional trading signal or calibrated probability forecast. The author describes it as an attempt to implement the method and explicitly expresses uncertainty about its correctness. The displayed extremes are sample bounds, not confidence intervals, and the random-number routine, return resampling assumptions, and drift adjustment are not validated in the document. More simulations may increase computation time enough to trigger platform limits, and the number of displayed paths is constrained by drawing limits.

Key ideas

  • The indicator resamples historical log returns to create sequential hypothetical price paths.
  • Its drift adjustment uses the sample average return and variance of the stored history.
  • It plots selected paths plus per-step simulated minimum and maximum closing values.
  • The horizon, number of simulations, and historical data window are user-configurable.
  • The author offers no validation, so the paths should be treated as exploratory scenarios rather than forecasts with established accuracy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.