Complete List of Supported Technical Indicators in the BanTA Go Library
The BanTA Go library provides over 50 pure-Go technical indicators—including moving averages, momentum oscillators, volatility measures, and trend analysis tools—all implemented as stateless, vectorized functions in the tav package.
The BanTA technical analysis engine (banbox/banta) offers a comprehensive suite of indicators designed for high-performance financial analysis. Every function in the tav package operates on []float64 slices, handles NaN values gracefully, and runs safely in concurrent environments without hidden global state.
Price Helpers and Basic Calculations
The foundation of technical analysis in BanTA starts with simple price transformations and summation utilities. These functions are defined in tav/indicators.go and provide the building blocks for complex calculations.
HL2(L8): Calculates the average of high and low prices.HLC3(L8): Returns the typical price (high + low + close) / 3.Sum(L24): Rolling summation over a specified period.
Moving Averages
BanTA implements multiple moving average variants to suit different trading strategies. All moving average functions are vectorized and accept a period parameter along with the input slice.
Simple and Weighted Averages
SMA(L24): Simple Moving Average—arithmetic mean over the lookback period.WMA(L89): Weighted Moving Average—linearly weighted toward recent prices.VWMA(L77): Volume-Weighted Moving Average—incorporates trading volume into the calculation.
Exponential and Adaptive Averages
EMAandEMABy(L66): Exponential Moving Average with standard and custom base calculations.RMAandRMABy(L66): Relative Moving Average (Wilder's smoothing).KAMAandKAMABy(L13): Kaufman Adaptive Moving Average—adjusts sensitivity based on market efficiency.ALMA(L48): Arnaud-Legoux Moving Average—combines Gaussian smoothing with offset control.
Specialized Averages
HMA(L35): Hull Moving Average—reduces lag while maintaining smoothness using weighted moving averages of half-period and full-period data.
Volatility and Bollinger Bands
Measure market volatility and price extremes with these core indicators defined in tav/indicators.go.
TR(L65): True Range—calculates the greatest of current high less current low, absolute value of current high less previous close, or absolute value of current low less previous close.ATR(L65): Average True Range—smoothed moving average of True Range.StdDevandStdDevBy(L85): Standard Deviation of price series.BBANDS(L26): Bollinger Bands—returns upper band, middle band (SMA), and lower band based on standard deviations from the mean.
Momentum Oscillators
Identify overbought and oversold conditions with BanTA's comprehensive oscillator suite.
RSIandRSIBy(L88): Relative Strength Index—measures speed and magnitude of price movements (0-100 scale).StochRSI(L40): Stochastic RSI—applies Stochastic oscillator formula to RSI values.MACDandMACDBy(L55): Moving Average Convergence Divergence—calculates the relationship between two EMAs of a price series.Stoch(L16): Stochastic %K—compares closing price to price range over a period.KDJandKDJBy(L57): KDJ indicator—derived from Stochastic oscillator with additional smoothing.CRSIandCRSIBy(L64): Connors RSI—composite oscillator combining RSI, streak duration, and percent rank.RMI(L5): Relative Momentum Index—variation of RSI using momentum rather than absolute gains/losses.CCI(L119): Commodity Channel Index—measures current price level relative to average price.MFI(L22): Money Flow Index—volume-weighted RSI variant.WillR(L66): Williams %R—momentum indicator similar to Stochastic but inverted scale.Stiffness(L16): Measures price momentum relative to moving average.ROC(L48): Rate of Change—percentage change between current price and price n periods ago.
Trend Analysis Tools
Determine trend direction and strength with these directional indicators.
ADXandADXBy(L5): Average Directional Index—quantifies trend strength regardless of direction.PluMinDIandpluMinDIBy(L56): Plus Directional Indicator (+DI) and Minus Directional Indicator (–DI).PluMinDMandpluMinDMBy(L84): Plus Directional Movement (+DM) and Minus Directional Movement (–DM).STC(L22): Schaff Trend Cycle—combines slow and fast MACD with stochastic smoothing.CTI(L15): Correlation Trend Indicator—measures linear correlation between price and time.LinRegandLinRegAdv(L31): Linear Regression and advanced variants with slope/intercept calculations.UTBot(L44): UT Bot indicator—trend following with ATR-based trailing stops.TD(L60): Tom DeMark Sequence—identifies potential price exhaustion points.
Volume-Based Indicators
Analyze volume-weighted price action and money flow.
VWMA(L77): Volume-Weighted Moving Average (also listed under MAs).CMF(L49): Chaikin Money Flow—combines price and volume to measure buying/selling pressure.MFI(L22): Money Flow Index (also listed under Momentum).
Statistical and Utility Functions
Helper functions for rolling calculations and price analysis.
HighestandLowest(L73): Rolling maximum and minimum values over a period.HighestBarandLowestBar(L81): Offset (index) of highest/lowest values relative to current bar.Sum(L24): Rolling summation.UpDown(L81): Up/Down momentum calculations.PercentRank(L30): Percentage rank of current value within lookback period.ER(L5): Efficiency Ratio—measures trend efficiency (Kaufman).AvgDev(L44): Average Deviation from mean.DV2(L84): DV2 indicator—normalized price position.
Implementation Architecture
All indicators in the BanTA Go library follow a consistent stateless, vectorized design pattern. The core implementations reside in tav/indicators.go, with each function accepting []float64 slices and returning calculated results of the same length.
Key architectural features include:
- Pure Go Implementation: No CGO dependencies; all calculations use native Go
float64operations. - NaN Handling: Functions gracefully propagate or ignore
NaNvalues in input series, ensuring robustness with incomplete market data. - Concurrency Safety: Stateless design means no global variables; functions are safe for concurrent use across goroutines.
- Series Wrappers: Higher-level APIs in
sta_inds.goprovide object-oriented*Serieswrappers for the core functions. - Python Bindings: The
python/tav/index.gofile exposes the same indicator set to Python environments via auto-generated bindings.
Complete Usage Example
The following example demonstrates how to import the tav package and calculate multiple technical indicators on price and volume data:
package main
import (
"fmt"
"log"
"math"
"github.com/banbox/banta/main/tav"
)
func main() {
// Example price series (close prices) and volume series
close := []float64{101, 102, 103, 102, 104, 105, 106, 107, 106, 108}
high := []float64{102, 103, 104, 103, 105, 106, 107, 108, 107, 109}
low := []float64{100, 101, 102, 101, 103, 104, 105, 106, 105, 107}
vol := []float64{1500, 1600, 1700, 1550, 1650, 1800, 1900, 2000, 1750, 2100}
// 1️⃣ Simple Moving Average (period 3)
sma := tav.SMA(close, 3)
fmt.Printf("SMA(3): %v\n", sma)
// 2️⃣ Exponential Moving Average (period 5)
ema := tav.EMA(close, 5)
fmt.Printf("EMA(5): %v\n", ema)
// 3️⃣ Relative Strength Index (period 14) – uses internal handling of insufficient data
rsi := tav.RSI(close, 14)
fmt.Printf("RSI(14): %v\n", rsi)
// 4️⃣ MACD (fast 12, slow 26, signal 9)
macd, signal := tav.MACD(close, 12, 26, 9)
fmt.Printf("MACD line: %v\nSignal line: %v\n", macd, signal)
// 5️⃣ Bollinger Bands (period 20, 2σ up/down)
upper, middle, lower := tav.BBANDS(close, 20, 2, 2)
fmt.Printf("BBANDS – Upper: %v\nMiddle: %v\nLower: %v\n", upper, middle, lower)
// 6️⃣ Stochastic %K (period 14)
stoch := tav.Stoch(high, low, close, 14)
fmt.Printf("Stoch %K: %v\n", stoch)
// 7️⃣ Aroon (period 25)
up, osc, down := tav.Aroon(high, low, 25)
fmt.Printf("Aroon Up: %v\nOscillator: %v\nDown: %v\n", up, osc, down)
// 8️⃣ VWMA (period 5)
vwma := tav.VWMA(close, vol, 5)
fmt.Printf("VWMA(5): %v\n", vwma)
// 9️⃣ ADX (period 14)
adx := tav.ADX(high, low, close, 14)
fmt.Printf("ADX(14): %v\n", adx)
// 🔟 CTI (Correlation Trend Indicator, period 20)
cti := tav.CTI(close, 20)
fmt.Printf("CTI(20): %v\n", cti)
// If any indicator returns NaN values, handle them as needed
for i, v := range rsi {
if !math.IsNaN(v) && v > 70 {
log.Printf("Overbought signal at index %d (RSI=%.2f)", i, v)
}
}
}
Summary
- The BanTA Go library (
banbox/banta) exposes over 50 technical indicators through thetavpackage, all implemented as pure Go functions. - All indicators are vectorized (batch) operations on
[]float64slices, designed to handleNaNvalues and support concurrent goroutine usage. - Core implementations reside in
tav/indicators.go, with higher-level series wrappers insta_inds.goand Python bindings available viapython/tav/index.go. - The library includes comprehensive coverage of moving averages (SMA, EMA, HMA, KAMA, ALMA), momentum oscillators (RSI, MACD, StochRSI, KDJ), volatility measures (ATR, Bollinger Bands), and trend tools (ADX, STC, CTI).
Frequently Asked Questions
What is the difference between EMA and RMA in the BanTA library?
EMA (Exponential Moving Average) applies a standard exponential smoothing factor where recent prices have exponentially more weight, while RMA (Relative Moving Average, also known as Wilder's smoothing) uses a different smoothing constant (1/period) that creates a slower, more stable average. Both are available in tav/indicators.go with EMABy and RMABy variants allowing custom base calculations.
How does BanTA handle missing or NaN values in indicator calculations?
All BanTA indicators are designed to gracefully handle NaN values in input slices without panicking. The vectorized implementations in tav/indicators.go propagate NaN values appropriately or skip them in rolling calculations, ensuring that indicators like RSI or ATR return valid results once sufficient non-NaN data is available in the lookback window.
Can I use BanTA indicators in concurrent goroutines?
Yes, the BanTA library is fully safe for concurrent use. All indicator functions are stateless and operate only on the input parameters provided, with no global variables or shared mutable state. This design allows you to calculate SMA, MACD, or Bollinger Bands across multiple goroutines simultaneously without synchronization concerns.
Where are the indicator implementations located in the source code?
The core algorithms for all supported technical indicators are implemented in tav/indicators.go. Higher-level object-oriented wrappers that maintain series state are found in sta_inds.go, while the public API facade exposed through the TA object is defined in core.go. Python bindings mirroring the Go API are auto-generated in python/tav/index.go.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →