Using randomness to quantify the potential losses of a trading portfolio.
Imagine you are a risk manager at a hedge fund. Your team manages a $1,000,000 "Blue Chip Tech" portfolio, holding stocks like Apple, Microsoft, Google, Amazon, NVIDIA, Meta, Tesla, etc. The CEO asks you a simple but crucial question: "How much money could this portfolio lose over the next year in a bad-case scenario?"
The future is uncertain. You can't give a single, definitive answer. This is where Monte Carlo simulation comes in. Instead of predicting one future, you simulate thousands of possible futures.
First, you analyze historical data to determine the portfolio's overall characteristics: its average annual return (the 'drift' or $\\mu$) and its annual volatility (the 'randomness' or $\\sigma$). Then, you use these two numbers to run a simulation that "walks" the portfolio's value forward thousands of times, generating a distribution of all the possible outcomes. This is exactly what the tool below does.
Each simulated path follows a model called Geometric Brownian Motion, a standard way to model stock prices. The formula for the portfolio's value at the end of the period is:
Once we have thousands of simulated final values ($S_T$), we can calculate the 95% VaR by finding the 5th percentile of our results. This is the value that separates the worst 5% of outcomes from the best 95%.
Total Simulations: 0 / 50,000
This simulation is a direct application of the Law of Large Numbers. Notice how when you run the simulation, the calculated VaR value might jump around a lot at first. As the number of simulations increases, the distribution becomes smoother and the VaR estimate converges towards a stable value.
This is why a high number of simulations is crucial. A simulation with only 100 paths is unreliable, but a simulation with 50,000 paths gives a much more robust and trustworthy estimate of the true risk.