編輯精選OPEN-SOURCE SCRIPT

Monte Carlo Simulation - Your Strategy [Kioseff Trading]

已更新
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.


快照

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

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


快照

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 (:
forecastingmonte-carloMONTECARLOstatisticsstrategyforecastingstrategytesting

開源腳本

在真正的TradingView精神中,這個腳本的作者以開源的方式發佈,這樣交易員可以理解和驗證它。請向作者致敬!您可以免費使用它,但在出版物中再次使用這段程式碼將受到網站規則的約束。 您可以收藏它以在圖表上使用。

想在圖表上使用此腳本?


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

•Discord Server: discord.gg/3cKVU28Z9Z
更多:

免責聲明