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.
|
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:
Download from ta-lib.org
Then install the gem:
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:
Price Transform (4)¶
Price averaging and transformation:
- AVGPRICE - Average Price
- MEDPRICE - Median Price
- TYPPRICE - Typical Price
- WCLPRICE - Weighted Close Price
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:
- CORREL - Pearson's Correlation Coefficient
- BETA - Beta Coefficient
- VAR - Variance
- STDDEV - Standard Deviation
- LINEARREG - Linear Regression
- LINEARREG_ANGLE - Linear Regression Angle
- LINEARREG_INTERCEPT - Linear Regression Intercept
- LINEARREG_SLOPE - Linear Regression Slope
- TSF - Time Series Forecast
Pattern Recognition (61)¶
Identify candlestick patterns:
- Doji - Doji Pattern
- Hammer - Hammer Pattern
- Engulfing - Engulfing Pattern
- Morning Star - Morning Star Pattern
- Evening Star - Evening Star Pattern
- Harami - Harami Pattern
- Piercing - Piercing Pattern
- Shooting Star - Shooting Star Pattern
- Marubozu - Marubozu Pattern
- Spinning Top - Spinning Top Pattern
- Dragonfly Doji - Dragonfly Doji Pattern
- Gravestone Doji - Gravestone Doji Pattern
- Two Crows - Two Crows Pattern
- Three Black Crows - Three Black Crows Pattern
- Three Inside - Three Inside Up/Down Pattern
- Three Line Strike - Three Line Strike Pattern
- Three Outside - Three Outside Up/Down Pattern
- Three White Soldiers - Three Advancing White Soldiers
- Dark Cloud Cover - Dark Cloud Cover Pattern
- Abandoned Baby - Abandoned Baby Pattern
- Hanging Man - Hanging Man Pattern
- Inverted Hammer - Inverted Hammer Pattern
- Kicking - Kicking Pattern
- Morning Doji Star - Morning Doji Star Pattern
- Evening Doji Star - Evening Doji Star Pattern
- High Wave - High-Wave Candle Pattern
- Hikkake - Hikkake Pattern
- Rickshaw Man - Rickshaw Man Pattern
- Takuri - Takuri (Dragonfly Doji with very long lower shadow)
- Tristar - Tristar Pattern
- Three Stars In The South - Three Stars In The South Pattern
- Advance Block - Advance Block Pattern
- Belt-hold - Belt-hold Pattern
- Breakaway - Breakaway Pattern
- Closing Marubozu - Closing Marubozu Pattern
- Concealing Baby Swallow - Concealing Baby Swallow Pattern
- Counterattack - Counterattack Pattern
- Doji Star - Doji Star Pattern
- Gap Side-by-Side White - Gap Side-by-Side White Pattern
- Harami Cross - Harami Cross Pattern
- Modified Hikkake - Modified Hikkake Pattern
- Homing Pigeon - Homing Pigeon Pattern
- Identical Three Crows - Identical Three Crows Pattern
- In-Neck - In-Neck Pattern
- Kicking by Length - Kicking by Length Pattern
- Ladder Bottom - Ladder Bottom Pattern
- Long Legged Doji - Long Legged Doji Pattern
- Long Line - Long Line Candle Pattern
- Matching Low - Matching Low Pattern
- Mat Hold - Mat Hold Pattern
- On-Neck - On-Neck Pattern
- Rising/Falling Three Methods - Rising/Falling Three Methods Pattern
- Separating Lines - Separating Lines Pattern
- Short Line - Short Line Candle Pattern
- Stalled Pattern - Stalled Pattern
- Stick Sandwich - Stick Sandwich Pattern
- Tasuki Gap - Tasuki Gap Pattern
- Thrusting - Thrusting Pattern
- Unique 3 River - Unique 3 River Pattern
- Upside Gap Two Crows - Upside Gap Two Crows Pattern
- Upside/Downside Gap Three Methods - Upside/Downside Gap Three Methods Pattern
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¶
- GitHub: Issues
- Email: dvanhoozer@gmail.com
License¶
MIT License - see LICENSE for details.