A comprehensive technical analysis library for financial markets written in Go.
Provides high-performance trading indicators for algorithmic trading, quantitative analysis, and financial applications.
go get github.com/shahid-2020/tradingindicators
package main
import (
"fmt"
"github.com/shahid-2020/techind/indicators"
)
func main() {
// Sample price data
prices := []float64{45.23, 46.50, 45.80, 47.20, 47.50, 48.10, 47.80, 49.20, 49.50, 48.80}
// Calculate moving averages
sma, _ := indicators.SMA(prices, 5)
ema, _ := indicators.EMA(prices, 5)
// Calculate MACD
macd, signal, histogram, _ := indicators.MACD(prices, 12, 26, 9)
fmt.Printf("SMA(5): %.2f\n", sma[len(sma)-1])
fmt.Printf("EMA(5): %.2f\n", ema[len(ema)-1])
fmt.Printf("MACD: %.4f, Signal: %.4f\n", macd[len(macd)-1], signal[len(signal)-1])
}
- SMA – Simple Moving Average
- EMA – Exponential Moving Average
- MACD – Moving Average Convergence Divergence
- RSI – Relative Strength Index (Wilder’s variant)
- ROC – Rate of Change
- CCI – Commodity Channel Index
- Stochastic Oscillator (%K, %D)
- Williams %R
- Bollinger Bands (Middle, Upper, Lower)
- ATR – Average True Range