Skip to content

rhayenga/monte-carlo-simulation

Repository files navigation

Monte Carlo & SMA Crossover Backtest

This project explores two quantitative finance techniques using Python in QuantConnect:

  • Monte Carlo Simulation: Models possible future price paths of Ralph Lauren (RL) stock.
  • SMA Crossover Backtest: Tests a 10-day vs. 50-day Simple Moving Average (SMA) trading strategy to evaluate historical performance and risk.

Project Overview

I built this project to strengthen my programming and quantitative finance skills:

  • Learned how to implement Monte Carlo simulations in Python.
  • Gained experience with backtesting trading strategies.
  • Developed a better understanding of Python functions, syntax, and files.
  • Important Note: This project will only be able to be run in QuantConnect. This code needs (Lean Engine) for backtesting and needs to be able to access QuantConnect's free API.

When I started, I had minimal Python experience — this project was a great interactive way to learn both coding and market modeling.


Tools & Libraries

  • QuantConnect (Lean Engine) for backtesting
  • Python for coding simulations and strategies

Acknowledgements

Special thanks to the YouTube channel QuantProgram for troubleshooting guidance on QuantConnect throughout the project.


Repository Contents

  • main.py → Algorithm code (Monte Carlo + SMA crossover)
  • research.ipynb → Research script exploring RL with Bollinger Bands
  • README.md → Project documentation
  • results.json → Full written results downloaded from QuantConnect. The essential results are pictured below.
  • Strategy Equity.png → Equity curve of the strategy
  • Drawdown.png → Historical drawdown chart
  • Assets Sales Volume.png → Trading activity and sales volume
  • Portfolio Margin.png → Portfolio margin usage
  • Overview 1.png, Overview 2.png → Sharpe ratio, win rate, average win/loss, total orders, net profit, and more statistics.

About

Backtesting a simple SMA crossover strategy with Monte Carlo simulation using QuantConnect

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages