Monte Carlo (Polyline Traceback) [Kioseff Trading]Hello!
This script "Monte Carlo (Polyline Traceback) " performs a Monte Carlo simulation using polylines!
By using polylines, and tracing back the initial simulation to its origin point, we can better replicate the ideal output of a Monte Carlo simulation!
Such as:
The image above shows the output of a simulation (image sourced outside TV).
With this script, and polyline capabilities, we can come quite close on TradingView.
The image above shows the indicator in action! Not bad considering the ideal output.
Of course, the script is quite heavy and tries its best to circumvent limitations :D
You might run into load time errors, in which case you might try applying the built-in setting "Force Script Load". This setting will cut-off the visuals for some simulations, but has a higher chance of passing load-time limitations!
As shown in the image above, you can select to only show worst-case and best-case simulations. Using this option will reduce chart lag and improve load times.
Features
Monte Carlo Simulation: Performs Monte Carlo simulation to generate multiple future paths.
Asset Price: Can simulate future asset prices based on historical log returns.
Statistical Methods: Offers two simulation methods—Gaussian (Normal) distribution and Bootstrapping.
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).
Best/Worst Case: Allows you to show only the best case / worst case outcome (range) for all simulations!
Thank you!
Simulations
MACD 50x Leveraged Strategy Real Equity Simulation Hello, I wrote this script to merge the two scripts I shared before.
The aim here is to see the real value of the state of the capital as a result of leveraged transactions and to combine both long and short directions.
Scripts :
MACD Long 50x Leverage Strategy :
MACD Short 50x Leverage Strategy :
The parameters have not changed so they are the same as the previous two scripts:
Adding margin: Forbidden or not specified. (Add Margin : No)
Position Size : %1 (0.01) (For each trade)
Stop-Loss : %2 (For each trade)
Long : Crossover(delta,0) (Standard MACD)
Long Exit : Long Stop Level or Short Entry
(In the case of Long Stop, all trades are closed and no positions are opened in short direction.)
Short : Crossunder(delta,0) (Standard MACD)
Short Exit : Short Stop or Long Entry
(In the case of Short Stop, all trades are closed and no positions are opened in the long direction.)
NOTE :
This is a simulation made using standard parameters, showing the state of the balance in very simple rules with leveraged transactions only.
The nice thing here is the direct observation of the results by making modifications on the strategy parameters.
Regards.
Example: Monte Carlo SimulationExperimental:
Example execution of Monte Carlo Simulation applied to the markets(this is my interpretation of the algo so inconsistencys may appear).
note:
the algorithm is very demanding so performance is limited.