Choix de la rédactionOPEN-SOURCE SCRIPT

Monte Carlo Simulation - Your Strategy [Kioseff Trading]

Mis à jour
Hello!

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

Features

  • 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.


snapshot

The image above shows the primary components of the indicator!

snapshot

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

snapshot

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

1
3
-3
2
-5

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

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


snapshot

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!

Notes de version
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!! (:

Notes de version
Added an option to set seed; values will remain stagnant now!

Thank you (:
forecastingmonte-carloMONTECARLOstatisticsstrategyforecastingstrategytesting

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?


•Access to Next-Gen Optimization Tools: kiosefftrading.com

•Discord Server: discord.gg/3cKVU28Z9Z
Aussi sur:

Clause de non-responsabilité