Run the moving-average crossover backtest end to end.
- Open a terminal in this folder.
- (Optional) Create and activate a virtual environment:
python -m venv venvvenv/Scripts/activate
- Install dependencies:
pip install -r requirements.txt - Run the script:
python main.py - When prompted, enter:
- Stock symbol (e.g.,
AAPL,MSFT) - Start date
YYYY-MM-DD - End date
YYYY-MM-DD
- Stock symbol (e.g.,
- Downloads historical prices via
yfinance. - Computes 50/200 simple moving averages and trades on golden/death crosses.
- Writes trade results and PnL to a timestamped
trade_results_*.txtfile.
- If you see SSL or network errors, retry later or switch networks.
- To rerun cleanly, delete old
trade_results_*.txtfiles if you want fresh outputs only.