Indicators
Complete reference of all available technical indicators and functions.
AlgoHive includes 100+ technical indicators and functions. This reference is organized by category.
Trend Indicators
Moving averages and trend-following indicators.
| Function | Description | Parameters |
|---|---|---|
SMA(source, period) | Simple Moving Average | source: close, period: 20 |
EMA(source, period) | Exponential Moving Average (faster reaction) | source: close, period: 20 |
WMA(source, period) | Weighted Moving Average | source: close, period: 20 |
DEMA(source, period) | Double EMA (reduced lag) | source: close, period: 20 |
TEMA(source, period) | Triple EMA (reduced lag) | source: close, period: 20 |
HMA(source, period) | Hull Moving Average (smooth, low lag) | source: close, period: 20 |
KAMA(source, period) | Kaufman Adaptive MA (adapts to volatility) | source: close, period: 30 |
T3(source, period, vFactor) | Extra-smoothed MA | source: close, period: 5, vFactor: 0.7 |
TRIMA(source, period) | Triangular MA (double-smoothed SMA) | source: close, period: 30 |
SAR(high, low, accel, max) | Parabolic SAR (stop-and-reverse) | high, low, accel: 0.02, max: 0.2 |
MIDPRICE(high, low, period) | Midpoint of high/low range | period: 14 |
MIDPOINT(source, period) | Midpoint of source values | source: close, period: 14 |
Struct-Returning Trend Indicators
| Function | Returns | Description |
|---|---|---|
MAMA(source, fast, slow) | {mama, fama} | MESA Adaptive MA |
Example:
trend: EMA(btc.close, 20)
fast: EMA(btc.close, 9)
slow: EMA(btc.close, 21)
bullish: fast > slowMomentum Indicators
Measure the speed and strength of price movements.
| Function | Description | Parameters |
|---|---|---|
RSI(source, period) | Relative Strength Index (0-100) | source: close, period: 14 |
CCI(high, low, close, period) | Commodity Channel Index | period: 20 |
WILLR(high, low, close, period) | Williams %R (-100 to 0) | period: 14 |
CMO(source, period) | Chande Momentum Oscillator | source: close, period: 14 |
ROC(source, period) | Rate of Change | source: close, period: 10 |
MOM(source, period) | Momentum (price difference) | source: close, period: 10 |
ADX(high, low, close, period) | Average Directional Index (trend strength) | period: 14 |
PLUS_DI(high, low, close, period) | +DI (bullish strength) | period: 14 |
MINUS_DI(high, low, close, period) | -DI (bearish strength) | period: 14 |
ULTOSC(h, l, c, p1, p2, p3) | Ultimate Oscillator | periods: 7, 14, 28 |
BOP(open, high, low, close) | Balance of Power | — |
TRIX(source, period) | Triple-smoothed EMA rate of change | source: close, period: 30 |
Struct-Returning Momentum Indicators
| Function | Returns | Description |
|---|---|---|
MACD(source, fast, slow, signal) | {line, signal, histogram} | Moving Average Convergence/Divergence |
STOCH(high, low, close, k, kSmooth, dSmooth) | {k, d} | Stochastic Oscillator |
STOCHF(high, low, close, k, d) | {fastk, fastd} | Fast Stochastic |
STOCHRSI(source, rsi, k, d) | {fastk, fastd} | Stochastic RSI |
AROON(high, low, period) | {aroonup, aroondown} | Aroon Up/Down |
Example:
macd: MACD(btc.close, 12, 26, 9)
macd_cross: cross_above(macd.line, macd.signal)
histogram_positive: macd.histogram > 0Volatility Indicators
Measure price volatility and typical ranges.
| Function | Description | Parameters |
|---|---|---|
TR() | True Range (uses OHLC) | — |
ATR(high, low, close, period) | Average True Range | period: 14 |
NATR(high, low, close, period) | Normalized ATR (percentage) | period: 14 |
TRANGE(high, low, close) | True Range (explicit inputs) | — |
Struct-Returning Volatility Indicators
| Function | Returns | Description |
|---|---|---|
BOLLINGER(source, period, stddev) | {upper, middle, lower} | Bollinger Bands |
KELTNER(period, mult) | {upper, middle, lower} | Keltner Channel |
DONCHIAN(period) | {upper, middle, lower} | Donchian Channel |
Example:
bb: BOLLINGER(btc.close, 20, 2)
squeeze: (bb.upper - bb.lower) / bb.middle < 0.05
at_lower: btc.close < bb.lowerVolume Indicators
Analyze trading volume.
| Function | Description | Parameters |
|---|---|---|
OBV() | On-Balance Volume | — |
VWAP() | Volume Weighted Average Price | — |
MFI(period) | Money Flow Index (0-100) | period: 14 |
AD(high, low, close, volume) | Chaikin A/D Line | — |
ADOSC(h, l, c, v, fast, slow) | Chaikin A/D Oscillator | fast: 3, slow: 10 |
Example:
money_flow: MFI(14)
mfi_oversold: money_flow < 20
volume_spike: btc.volume > SMA(btc.volume, 20) * 2Comparison Functions
Return boolean (true/false) values for conditions.
| Function | Description | Parameters |
|---|---|---|
CROSS_ABOVE(a, b) | True when a crosses above b | a, b: any values |
CROSS_BELOW(a, b) | True when a crosses below b | a, b: any values |
RISING(source, length) | True when source is higher than length bars ago | length: 1 |
FALLING(source, length) | True when source is lower than length bars ago | length: 1 |
Example:
golden_cross: cross_above(EMA(btc.close, 50), EMA(btc.close, 200))
rising_rsi: rising(RSI(btc.close, 14), 3)Math Functions
Mathematical operations on data.
| Function | Description | Parameters |
|---|---|---|
HIGHEST(source, length) | Highest value over period | source, length: 14 |
LOWEST(source, length) | Lowest value over period | source, length: 14 |
SUM(source, length) | Sum over period | source, length: 14 |
STDEV(source, length) | Standard deviation | source, length: 14 |
CHANGE(source, length) | Difference from length bars ago | source, length: 1 |
PCT_CHANGE(source, length) | Percent change | source, length: 1 |
ABS(value) | Absolute value | value |
MAX(a, b) | Maximum of two values | a, b |
MIN(a, b) | Minimum of two values | a, b |
SQRT(value) | Square root | value |
IF(cond, then, else) | Conditional value | condition, then, else |
Example:
range_high: HIGHEST(btc.high, 20)
range_low: LOWEST(btc.low, 20)
range_pct: (range_high - range_low) / range_lowTime Functions
Access bar timestamp information.
| Function | Returns | Description |
|---|---|---|
HOUR_UTC() | number | UTC hour (0-23) |
HOUR_ET() | number | US Eastern hour (0-23) |
DAY_OF_WEEK() | number | ISO weekday (1=Mon, 7=Sun) |
DAY() | number | Day of month (1-31) |
MONTH() | number | Month (1-12) |
IS_MONDAY() | boolean | True on Monday |
IS_FRIDAY() | boolean | True on Friday |
IS_WEEKEND() | boolean | True on Sat/Sun |
IS_DATE(date) | boolean | True on specific date (YYYY-MM-DD) |
DATE_DIFF(date1, date2) | number | Days between dates |
Example:
asian_session: HOUR_UTC() >= 0 AND HOUR_UTC() < 8
no_weekend: NOT IS_WEEKEND()Position Functions
Access information about open positions. Only available in manage rule expressions.
| Function | Returns | Description |
|---|---|---|
ENTRY_BAR() | number | Bar index at entry |
ENTRY_PRICE() | number | Entry price |
ENTRY_TIME() | number | Entry timestamp (ms) |
POSITION_PNL() | number | Unrealized P&L ($) |
POSITION_PNL_PCT() | number | Unrealized P&L (%) |
POSITION_PNL_R() | number | Unrealized P&L (R-multiples) |
Example (in manage rule):
in_profit: POSITION_PNL_PCT() > 0.02
breakeven_stop: ENTRY_PRICE()Statistical Functions
Linear regression and statistical analysis.
| Function | Description |
|---|---|
LINEARREG(source, period) | Linear regression value |
LINEARREG_SLOPE(source, period) | Slope of regression |
LINEARREG_ANGLE(source, period) | Angle in degrees |
TSF(source, period) | Time Series Forecast |
CORREL(source1, source2, period) | Correlation (-1 to 1) |
BETA(source1, source2, period) | Beta coefficient |
Price Transform
Common price calculations.
| Function | Description |
|---|---|
AVGPRICE(o, h, l, c) | (O+H+L+C) / 4 |
MEDPRICE(h, l) | (H+L) / 2 |
TYPPRICE(h, l, c) | (H+L+C) / 3 |
WCLPRICE(h, l, c) | (H+L+2C) / 4 |
Candlestick Patterns
Detect candlestick patterns. Return +100 (bullish), -100 (bearish), or 0 (no pattern).
| Function | Pattern |
|---|---|
CDLDOJI() | Doji (indecision) |
CDLHAMMER() | Hammer (bullish reversal) |
CDLENGULFING() | Engulfing (reversal) |
CDLMORNINGSTAR() | Morning Star (bullish) |
CDLEVENINGSTAR() | Evening Star (bearish) |
CDL3WHITESOLDIERS() | Three White Soldiers (bullish) |
CDL3BLACKCROWS() | Three Black Crows (bearish) |
Example:
hammer_signal: CDLHAMMER() > 0
bearish_pattern: CDLENGULFING() < 0See the full list of 60+ candlestick patterns in the function registry.