Monte Carlo Simulation - Your Strategy [Kioseff Trading]

KioseffTrading 已更新   

This script “Monte Carlo Simulation - Your Strategy” uses Monte Carlo simulations for your inputted strategy returns or the asset on your chart!


  • Monte Carlo Simulation: Performs Monte Carlo simulation to generate multiple future paths.
  • Asset Price or Strategy: Can simulate either future asset prices based on historical log returns or a specific trading strategy's future performance.
  • User-Defined Input: Allows you to input your own historical returns for simulation.
  • Statistical Methods: Offers two simulation methods—Gaussian (Normal) distribution and Bootstrapping.
  • Graphical Display: Provides options for graphical representation, including line plots and histograms.
  • Cumulative Probability Target: Enables setting a user-defined cumulative probability target to quantify simulation results.
  • Adjustable Parameters: Offers numerous user-adjustable settings like number of simulations, forecast length, and more.
  • Historical Data Points: Option to specify the amount of historical data to be used in the simulation (price).
  • Custom Binning: Allows you to select the binning method for histograms, with options like Sturges, Rice, and Square Root.
  • Best/Worst Case: Allows you to show only the best case / worst case outcome (range) for all simulations!
  • Scatterplot: allows you to show up to 1000 potential outcomes for a specified trade number (or bars forward price endpoint) using a scatter plot.

The image above shows the primary components of the indicator!

The image above shows the best/worst case outcome feature in action!

The image above shows a "fun feature" where 1000 simulated end points for a 15-bar price trajectory are shown as a scatter plot!

How To Perform a Monte Carlo Simulation On Your Strategy

Really, you can input any data into the indicator it will perform a Monte Carlo Simulation on it :D

The following instructions show how to export your strategy results from TradingView to an Excel File, copy the data, and input it into the indicator.

However, you are not limited to following this method!

Wherever your strategy results are stored, simply copy and paste them into the indicator text area in the settings and simulations will begin.

Returns Should Follow This Format


The numbers are presented as a single column. No commas or separators used.

The numbers above are in sequential order. A return of "1" for the first trade and a return of "-5" for the last trade. Your strategy returns will likely be in sequential order already so don't worry too much about this (:

How To Perform a Monte Carlo Simulation On Your TradingView Strategy With Excel Data

  • Export your strategy returns to an excel file using TradingView
  • Navigate to your downloads folder to column G "Profit"
  • Click the column and press CTRL + SPACE to highlight the entire column
  • Press CTRL + C to copy the entire column
  • Open this indicator's settings and paste the returns into the text area

The image above illustrates the process!

Notes on Inputting Returns

*Must input your returns without a separate as a vertical list
*The initial text area can only hold so many return values. If your list of trades is large you can input additional returns into two additional text areas at the bottom of the indicator settings.

That should be it; thank you for checking this out!

Added an extra returns text area for strategies with a large number of trades.

Of course shoutout to @RicardoSantos for all the materials he shared!! (:
Added an option to set seed; values will remain stagnant now!

Thank you (:

•Access to Next-Gen Optimization Tools:

•Access to Proprietary Data:

•Discord Server:

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。