| name | technical-indicators |
| description | Calculate technical analysis indicators for stock market analysis |
Technical Indicators Calculator
Quick guide for calculating technical indicators using Python and pandas-ta.
Quick Start
import yfinance as yf
import pandas_ta as ta
df = yf.download('AAPL', period='1y')
df['RSI'] = ta.rsi(df['Close'], length=14)
print(df[['Close', 'RSI']].tail())
Key Indicators
1. RSI (Relative Strength Index)
df['RSI'] = ta.rsi(df['Close'], length=14)
2. SMA (Simple Moving Average)
df['SMA_50'] = ta.sma(df['Close'], length=50)
3. EMA (Exponential Moving Average)
df['EMA_12'] = ta.ema(df['Close'], length=12)
4. MACD
macd = ta.macd(df['Close'])
5. Bollinger Bands
bbands = ta.bbands(df['Close'], length=20)
6. ADX (Trend Strength)
adx = ta.adx(df['High'], df['Low'], df['Close'], length=14)
7. ATR (Volatility)
df['ATR'] = ta.atr(df['High'], df['Low'], df['Close'], length=14)
8. Stochastic Oscillator
stoch = ta.stoch(df['High'], df['Low'], df['Close'], length=14)
9. OBV (On-Balance Volume)
df['OBV'] = ta.obv(df['Close'], df['Volume'])
Complete Example
import yfinance as yf
import pandas as pd
import pandas_ta as ta
ticker = 'AAPL'
df = yf.download(ticker, period='2y')
df['RSI'] = ta.rsi(df['Close'], length=14)
df['SMA_20'] = ta.sma(df['Close'], length=20)
df['SMA_50'] = ta.sma(df['Close'], length=50)
df['EMA_12'] = ta.ema(df['Close'], length=12)
macd = ta.macd(df['Close'])
df = pd.concat([df, macd], axis=1)
bbands = ta.bbands(df['Close'], length=20)
df = pd.concat([df, bbands], axis=1)
df['ATR'] = ta.atr(df['High'], df['Low'], df['Close'], length=14)
print(df[['Close', 'RSI', 'SMA_20', 'SMA_50', 'ATR']].tail())
Resources