Skip to content

SQA::TAI - Technical Analysis Indicators

Ruby wrapper around the legendary TA-Lib C library, providing 132 technical analysis indicators with a clean Ruby API.
Part of the SQA (Simple Qualitative Analysis) ecosystem.

SQA - Simple Qualitative Analysis

Features

📊 **132 Indicators** - Comprehensive coverage with 94% of trading-relevant TA-Lib indicators
⚡ **Blazing Fast** - C library performance with Ruby convenience
🎯 **Clean API** - Simple, intuitive interface with keyword arguments
✅ **Well Tested** - 73 tests, 332 assertions, comprehensive coverage
🔒 **Type Safe** - Parameter validation and error handling
🐛 **Bug Fixed** - Includes monkey patch for ta_lib_ffi 0.3.0 multi-array parameter bug

Quick Example

require 'sqa/tai'

# NOTE: All arrays passed to the TA-Lib functions
#       are in ascending order oldest data to newest

prices = [44.34, 44.09, 44.15, 43.61, 44.33, 44.83,
          45.10, 45.42, 45.84, 46.08]

# Calculate indicators
sma = SQA::TAI.sma(prices, period: 5)
rsi = SQA::TAI.rsi(prices, period: 14)
upper, middle, lower = SQA::TAI.bbands(prices, period: 20)

puts "SMA: #{sma.last}"
puts "RSI: #{rsi.last}"

Installation

First, install the TA-Lib C library:

brew install ta-lib
wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz
tar -xzf ta-lib-0.4.0-src.tar.gz
cd ta-lib/
./configure --prefix=/usr
make
sudo make install

Download from ta-lib.org

Then install the gem:

gem install sqa-tai

Indicator Categories (132 Total)

Overlap Studies (15)

Moving averages and bands for trend analysis:

  • SMA - Simple Moving Average
  • EMA - Exponential Moving Average
  • WMA - Weighted Moving Average
  • DEMA - Double Exponential Moving Average
  • TEMA - Triple Exponential Moving Average
  • TRIMA - Triangular Moving Average
  • KAMA - Kaufman Adaptive Moving Average
  • T3 - Triple Exponential Moving Average (T3)
  • BBANDS - Bollinger Bands
  • SAREXT - Parabolic SAR Extended
  • HT_TRENDLINE - Hilbert Transform Instantaneous Trendline
  • MAMA - MESA Adaptive Moving Average
  • MAVP - Moving Average with Variable Period
  • MIDPOINT - Midpoint over period
  • MIDPRICE - Midpoint Price over period

Momentum Indicators (30)

Measure rate of price change:

  • RSI - Relative Strength Index
  • MACD - Moving Average Convergence/Divergence
  • STOCH - Stochastic Oscillator
  • MOM - Momentum
  • CCI - Commodity Channel Index
  • WILLR - Williams' %R
  • ROC - Rate of Change
  • ROCP - Rate of Change Percentage
  • ROCR - Rate of Change Ratio
  • PPO - Percentage Price Oscillator
  • ADX - Average Directional Index
  • ADXR - Average Directional Movement Index Rating
  • APO - Absolute Price Oscillator
  • AROON - Aroon Indicator
  • AROONOSC - Aroon Oscillator
  • BOP - Balance of Power
  • CMO - Chande Momentum Oscillator
  • DX - Directional Movement Index
  • MACDEXT - MACD with Controllable MA Type
  • MACDFIX - MACD Fix 12/26
  • MFI - Money Flow Index
  • MINUS_DI - Minus Directional Indicator
  • MINUS_DM - Minus Directional Movement
  • PLUS_DI - Plus Directional Indicator
  • PLUS_DM - Plus Directional Movement
  • ROCR100 - Rate of Change Ratio 100 scale
  • STOCHF - Stochastic Fast
  • STOCHRSI - Stochastic RSI
  • TRIX - 1-day ROC of Triple Smooth EMA
  • ULTOSC - Ultimate Oscillator

Volatility Indicators (4)

Measure price volatility:

  • ATR - Average True Range
  • NATR - Normalized Average True Range
  • TRANGE - True Range
  • SAR - Parabolic SAR

Volume Indicators (3)

Analyze trading volume:

  • OBV - On Balance Volume
  • AD - Chaikin A/D Line
  • ADOSC - Chaikin A/D Oscillator

Price Transform (4)

Price averaging and transformation:

Cycle Indicators (5)

Identify market cycles:

  • HT_DCPERIOD - Hilbert Transform - Dominant Cycle Period
  • HT_TRENDMODE - Hilbert Transform - Trend vs Cycle Mode
  • HT_DCPHASE - Hilbert Transform - Dominant Cycle Phase
  • HT_PHASOR - Hilbert Transform - Phasor Components
  • HT_SINE - Hilbert Transform - SineWave

Statistical Functions (9)

Statistical analysis and regression:

Pattern Recognition (61)

Identify candlestick patterns:

SQA Ecosystem

SQA::TAI is part of a larger ecosystem:

  • sqa - Trading strategy framework
  • sqa-tai - Technical indicators (this gem)
  • sqa-cli - CLI tool with AI integration

Next Steps

Support

License

MIT License - see LICENSE for details.