LonesomeTheBlue

Monte Carlo Simulation - Random Walk

LonesomeTheBlue Wizard Обновлено   
Hello All,


Monte Carlo Simulation is a model used to predict the probability of different outcomes when the intervention of random variables is present. it is used by professionals in such widely disparate fields as finance, project management etc. You can find many articles about Monte Carlo Simulation on the net.

In this script I tried to make Monte Carlo Simulation and "Random Walk". it calculates results over and over, each time using a different set of random values that is created using historical data (500 times by default) and show min-max and some random paths. number of "random walks" is calculated by using number of bars to predict, so if you change "Number of Bars to Predict" then number of random walks may change. Total number of the lines must be less than 500.

"Number of Simulations" is 500 by default, more simulation better results. but if you increase it a lot then you may get "loop takes too long error"
"Number of Bars to Predict"
can be between 10-100
"Number of Bars to use as Data Source" is the number of historical bars to use in simulations

Thanks to Ricardo Santos (@RicardoSantos) for letting me use his Random Number Generator Function.

P.S. I am not mathematician and I tried to make it as far as I understood the method. so if you see any issue let me know please.

Some examples:

Number of Bars to Predict = 100:

Number of Bars to Predict = 10:

if you enable "Keep Past Min-Max Levels" option then min-max levels will stay on the chart


Enjoy!
Информация о релизе:
Added color option for Random Walk
Информация о релизе:
updated

Скрипт с открытым кодом

В истинном духе TradingView автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения. Вы можете добавить этот скрипт в избранное и использовать его на графике.

Отказ от ответственности

Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.

Хотите использовать этот скрипт на графике?