A simple web application that allows you to backtest a trading strategy using moving average crossovers. This project uses Python, Streamlit, and Yahoo Finance data.
- Fetches historical stock data from Yahoo Finance
- Implements a short and long moving average crossover strategy
- Displays buy and sell signals on an interactive chart
- Allows customization of parameters such as time range and moving average windows
git clone https://github.com/Konikz/Trading_Strategy_Backtester.gitcd Trading_Strategy_Backtesterpip install -r requirements.txtIf you do not have a requirements.txt file, install dependencies manually:
pip install streamlit yfinance pandas matplotlibRun the Streamlit application:
streamlit run app.pyA new browser window will open. You can then:
- Enter the stock ticker symbol (e.g., AAPL).
- Specify the date range.
- Adjust the short and long moving average windows.
- Observe the plotted stock price and moving averages, along with buy and sell signals.
Trading_Strategy_Backtester/
│
├── app.py # Main Streamlit application
├── backtester.py # Optional script for local backtesting
├── requirements.txt # List of Python dependencies
└── README.md # Project documentation
Contributions are welcome. To propose a change:
- Fork the repository.
- Create a new feature branch.
- Commit your changes.
- Open a pull request.