Skip to content

Quantabhi/Stock-Data-Backtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Stock Data Analysis with TA

Image 1 Image 2 Image 3 Image 4

Getting Started

Streamlit web application provides an interactive interface for analyzing stock data using various technical analysis indicators like Moving Averages (MA), Relative Strength Index (RSI), and Moving Average Convergence Divergence (MACD)

Library Use

  • pip streamlit
  • pip pandas
  • pip install matplotlib
  • pip yfinance

Cumulative Profit/Loss from 50-day and 200-day MA Crossover

The script iterates through each row of stock data, detecting buy and sell signals based on the crossover of two moving averages (MA). When the shorter-term MA crosses above the longer-term MA, it triggers a buy signal, and when it crosses below, it triggers a sell signal. The script calculates the profit/loss (PNL) for each trade and accumulates the PNL over time. It also handles the case where no signal is detected, ensuring the PNL remains unchanged in such instances.

Cumulative Profit/Loss from Relative Strength Index (RSI) buy rsi is 20 and sell rsi is 80

This section of the code calculates the Relative Strength Index (RSI) for the stock data and generates buy and sell signals based on RSI thresholds. It then computes the cumulative profit/loss (PNL) for trades executed according to these signals. This enables the analysis of trading strategies utilizing RSI indicators within the specified time frame.

Cumulative Profit/Loss from Moving Average Convergence Divergence(MACD)

This section of the code defines a function to calculate the Moving Average Convergence Divergence (MACD) indicator for the stock data. It then generates buy and sell signals based on MACD crossovers and computes the cumulative profit/loss (PNL) for trades executed according to these signals. This facilitates the analysis of trading strategies utilizing MACD indicators within the specified time frame.