Student: Christina Gebrekirstoes
Course: BDA400 – Data Science Tools and Techniques
Assignment: Assignment 6 – Technical Analysis using R, Visualization Phase
Repository: TechnicalAnalysis
This project is an interactive R Shiny technical-analysis dashboard for retrieving, visualizing, and analyzing historical stock-market data. Yahoo Finance is the primary data source, with Stooq available as an alternate source and automatic fallback if the preferred source cannot return data.
- Historical stock-data retrieval using
quantmod - Yahoo Finance primary data source with Stooq alternate/fallback support
- Daily, Weekly, and Monthly time frames
- User-controlled stock symbol and date range
- Line, Candlestick, and Area chart options
- Fast and Slow Simple Moving Averages (SMA) with customizable periods
- Relative Strength Index (RSI)
- Moving Average Convergence Divergence (MACD)
- Technical indicators that can be enabled or disabled dynamically
- Customizable trading rules using SMA crossover logic
- Optional RSI confirmation for Buy/Sell signals
- Optional MACD confirmation for Buy/Sell signals
- Buy, Sell, and Hold trading states
- Buy/Sell annotations on the stock chart
- Trading-signal summary table
- Dashboard metrics for source used, latest close, and latest trading state
- Validation and error handling for invalid symbols, invalid date ranges, insufficient history, and unavailable stock data
The application uses the following packages:
shinyggplot2quantmodTTRgridExtra
The application checks for missing packages and installs them automatically when necessary.
app.R
The app.R file contains the complete Shiny user interface, server logic, stock-data retrieval and fallback workflow, time-frame conversion, technical-indicator calculations, chart rendering, trading-signal rules, validation, and error handling.
The dashboard calculates a Fast SMA and Slow SMA using user-selected periods.
- Buy: Fast SMA crosses above Slow SMA.
- Sell: Fast SMA crosses below Slow SMA.
- Hold: No new crossover event occurs.
Users may optionally require RSI and/or MACD confirmation before a crossover is treated as a Buy or Sell event.
- Download or clone this repository.
- Open the project folder in RStudio.
- Open
app.R. - Click Run App.
- Enter or select a stock symbol and date range.
- Select Daily, Weekly, or Monthly analysis.
- Select Line, Candlestick, or Area chart type.
- Configure the technical indicators and trading-rule parameters as desired.
- Review the dashboard chart, RSI/MACD panels, trading annotations, and signal table.
app.R– complete R Shiny dashboardREADME.md– project documentation and setup instructions- Public GitHub repository containing the assignment files
Christina Gebrekirstoes