TA-Lib & Indicators
Kafal exposes technical analysis primitives through the ta.* namespace.
C-Bindings & Python Fallbacks
Kafal dynamically inspects the C-based TA-Lib library at startup. All 150+ standard functions are bound into the runtime environment. If the library is absent, Kafal supplies pure-Python vectorized implementations for core indicators.
// Moving averages and momentum indicators
fast_ema = ta.ema(close, 10)
slow_ema = ta.ema(close, 30)
// Multi-output indicators unpack directly into tuple assignments
macd_line, signal_line, hist = ta.macd(close, 12, 26, 9)
upper_band, basis, lower_band = ta.bbands(close, 20, 2.0, 2.0)Native Quantitative Indicators
In addition to TA-Lib, Kafal bundles native quantitative primitives directly into the root environment. Swing pivots automatically apply a strict historical right-shift to prevent lookahead bias.
// Institutional & Price Action Primitives
st_line, trend_dir = ta.supertrend(high, low, close, 10, 3.0)
vwap_line = ta.vwap(high, low, close, volume)
// Volatility Channels
donchian_upper, donchian_mid, donchian_lower = ta.donchian(high, low, 20)
keltner_upper, keltner_basis, keltner_lower = ta.keltner(high, low, close, 20, 2.0)
// Lookahead-Free Swing Pivots (5 bars left, 5 bars right)
pivot_h = ta.pivothigh(high, 5, 5)