Monte Carlo Stock Predictor - GBM & OU Comparison

Version 1.4 (4.19 KB) by Benjamin
A Monte Carlo stock prediction code comparing Geometric Brownian Motion and Mean Reversion mathematical models.
9 Downloads
Updated 27 Oct 2025

View License

This is a fun, interesting introduction to quantitative finance using two commonly used mathematical models following stochastic price movements.
The example provided used one year of data from bitcoin found on MarketWatch. Only csv files can be imported into the script and used to extract the relevant data.
Choosing between a crypocurrency/currency or a stock determines the number of days of change in a given year. Then you can choose how long you wish the projection to be for in years. Finally, enter the number of simulations. A reasonable and fast number will be anything from 1000 - 10000.
As a check that the data imported is compatible to work with, the most common gap in days between entries under Initial Computations must be "1".
The simulation returns the Geometric Brownian Motion (GBM) and Mean Reversion (OU) summary, yielding a mean final price, probility of increase, decrease, and, maximum and minimum predicted prices. These are then compiled and compared yielding a final probability of increase or decrease.
As a check of accuracy, if both GBM and OU agree, the Position to Open yields a "conclusive result".
However, THIS IS NOT FINANCIAL ADVICE AND SHOULD NOT BE USED.
See the example below using bitcoin.

Cite As

Benjamin (2025). Monte Carlo Stock Predictor - GBM & OU Comparison (https://nl.mathworks.com/matlabcentral/fileexchange/181412-monte-carlo-stock-predictor-gbm-ou-comparison), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2025a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: Monte Carlo Stock Price Predictor

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.4

- Improved volatility predictions for OU model
- Fixed bugs

1.3

*larger data can be inputted

1.2

*Able to input more than a year data now

1.0.0