This project analyzes S&P 500 stock data from 1927 to 2020 to evaluate the effectiveness of two widely used technical indicators: the Simple Moving Average (SMA) and the Exponential Moving Average (EMA). The analysis focuses on generating buy/sell signals, comparing SMA vs. EMA performance, and identifying which may serve better for long- vs. short-term investment strategies.
- Analyze daily returns of the S&P 500 index
- Calculate and visualize 20-day SMA and EMA
- Generate and evaluate buy/sell signals based on trend crossovers
- Explore indicator strengths and limitations in predicting market behavior
- Python 3.9
- Pandas (for data manipulation)
- Matplotlib (for plotting)
- Jupyter Notebook
- Excel (for initial data handling)
S&P 500 historical data sourced from Nasdaq:
https://www.nasdaq.com/market-activity/index/spx/historical
See the detailed analysis and insights in the Final Report (PDF)
jupyter_notebook_analysis.ipynb: Python code and visualizationsreport.pdf: Full project report and conclusions.gitignore: Tracks excluded files (e.g.,.ipynb_checkpoints/)
- SMA performs better for long-term investment strategies
- EMA is more responsive and suitable for short-term trading
- Both indicators are lagging and work best when used with other tools (e.g., RSI, MACD)
- Seasonal trends and trend reversals can provide added context when interpreting moving averages
For questions or feedback, feel free to reach out via GitHub or email.