Indicators
Every indicator the rule engine knows, with its parameters and output fields.
An indicator is referenced inside a leaf as `{indicator: <kind>, ...params}`. Each kind exposes one or more output fields you can address via `field: <name>` (omit `field` for the default first field). Multi-timeframe is supported via `timeframe: '4h'` on any indicator.
| Kind | Parameters | Output fields | Typical use |
|---|---|---|---|
| ema | period (>=1) | value | Trend filter. `ema20 > ema50` for up-bias. |
| sma | period (>=1) | value | Same as EMA but no smoothing memory. |
| rsi | period (default 14, >=2) | value (0–100) | Mean reversion. `rsi < 30` long, `rsi > 70` short. |
| macd | fast (12), slow (26), signal (9); fast < slow | line, signal, hist | Momentum. `hist crosses_above 0` for entry. |
| bollinger | period (20), std_mult (2.0) | mid, upper, lower | Volatility envelope. `close < lower` for bounce entries. |
| atr | period (14, >=2) | value | Stop-distance sizing. `stop = entry - atr14 * 2`. |
| atr_sma | atr_period (default 14), sma_period (default 14) | value (smoothed ATR), atr (raw) | Smoother volatility baseline. `atr14 > atr_sma` = volatility expanding. |
| stochastic | period (14), smooth_d (3) | k, d (both 0–100) | Cross 20 / 80 lines for mean reversion. |
| adx | period (14) | adx, plus_di, minus_di | `adx > 25` = trending. Pair with `plus_di > minus_di` for up-bias. |
| vwap | anchor (session/day/week/month/rolling), period (20, rolling only) | value | Fair-value reference. `close > vwap` = above-average price. |
| volume_ma | period (20) | value | Breakout confirmation. `volume > volume_ma * 1.5`. |
| donchian | period (default 20, >=2) | upper, lower, mid | Breakout channel. `close > upper` for breakout entries; `mid` as trend reference. |
| swing | lookback (1) | last_high, last_low, prev_high, prev_low | Breakout entries (`close > last_high`) and HH/HL filters. |
| s_trend | lookback (1) | value (-1 / 0 / +1) | SMC-style BOS/CHoCH trend regime — flips after two same-side swing breakouts. |
| blackflag_fts | atr_period (14), atr_factor (1.6), fib_lookback (8) | trail, extreme, state, fib1, fib2, fib3 | SuperTrend variant with Black Flag's modified TR and a 38.2 / 50 / 61.8 Fib pullback ladder. |
| super_trend | atr_period (10), factor (3.0) | trail, state | Standard SuperTrend on `hl2`. `state == 1` long regime, `state == -1` short regime. |
| trend_magic | cci_period (20), atr_period (5), atr_mult (1.0) | trail, state, cci | CCI-gated ATR ratchet. Stop ratchets in trend direction while CCI agrees with regime. |
| ema_pullback | ema_fast (100), ema_slow (200), ema_regime (500), atr_period (14), … | long_signal, short_signal, ema_fast, ema_slow, ema_regime, atr, wait_long, wait_short | Composite long/short entry model. `long_signal == 1` to enter on a confirmed pullback. |
| vfi | length (130), coef (0.2), v_coef (2.5), signal (5) | vfi, signal, hist | Volume Flow Indicator. Oscillator — `vfi > 0` accumulation, `< 0` distribution, `hist` for cross signals. |
| market_structure | swing_lookback (5) | state, bos_signal, choch_signal, pivot_high, pivot_low, last_pivot_high, last_pivot_low | SMC market structure on swing pivots. `state` = current regime, `bos_signal` / `choch_signal` fire one bar. |
| fair_value_gap | min_gap_pct (0.0), expire_bars (0 = never) | bull_top, bull_bottom, bear_top, bear_bottom, bull_signal, bear_signal, bull_filled, bear_filled | 3-bar imbalance with fill tracking. Use `bull_signal` to enter on FVG formation, `bull_filled` to track mitigation. |
| order_block | swing_lookback (5), retest_tolerance_pct (0.1) | bull_top, bull_bottom, bear_top, bear_bottom, bull_signal, bear_signal, bull_retest, bear_retest, bull_mitigated, bear_mitigated | Last opposite candle before a BOS. `bull_retest` triggers when price returns into the zone. |
| equal_highs_lows | lookback (10), tolerance_pct (0.05) | eqh_level, eql_level, eqh_signal, eql_signal, eqh_swept, eql_swept | Liquidity pool detection. `eqh_swept` confirms a stop hunt above equal highs — common reversal trigger. |
| prior_period_levels | (no params — keys off the bar timestamp) | pdh, pdl, pdo, pdc, pwh, pwl, pwo, pwc, pmh, pml, pmo, pmc | Prior day / week / month H/L/O/C. `close > pdh` for break-of-prior-day-high momentum filters. |
| premium_discount_zones | trailing_lookback (50) | trailing_top, trailing_bottom, premium_top, premium_bottom, equilibrium_top, equilibrium_bottom, discount_top, discount_bottom, current_zone | Fib-zone classification of the trailing range. `current_zone == 'discount'` for SMC long bias. |
New indicator catalogue
The ten indicators added in the Pine-port and SMC clean-room waves. Each card lists description, parameters with defaults, output fields, and a copy-pasteable YAML snippet.
Exponential Moving Average (EMA)
emaExponential moving average — a trend line that weights recent prices more heavily, so it turns faster than an SMA. Read its slope for direction, or compare a fast and slow EMA (fast above slow = up-bias).
- Parameters:
- period (20)
- Fields:
- value
YAML
leaf:
lhs: { price: close }
op: gt
rhs: { indicator: ema, period: 50, field: value }
dir: longSimple Moving Average (SMA)
smaSimple moving average — the plain average close over N bars, giving a smooth trend line. Price above the SMA is a basic up-bias; crossovers of two SMAs flag trend changes.
- Parameters:
- period (20)
- Fields:
- value
YAML
leaf:
lhs: { price: close }
op: gt
rhs: { indicator: sma, period: 200, field: value }
dir: longRelative Strength Index (RSI)
rsiRelative Strength Index — a 0–100 momentum oscillator. Classic reads: below 30 is oversold (look for longs), above 70 overbought (look for shorts), and 50 acts as a trend pivot.
- Parameters:
- period (14)
- Fields:
- value
YAML
leaf:
lhs: { indicator: rsi, period: 14, field: value }
op: lt
rhs: { value: 30 }
dir: longMACD
macdMoving-average convergence/divergence — momentum read from the gap between a fast and slow EMA. The histogram crossing zero, or the MACD line crossing its signal line, marks momentum shifts.
- Parameters:
- fast (12), slow (26), signal (9)
- Fields:
- line, signal, hist, fast_ema, slow_ema
YAML
leaf:
lhs: { indicator: macd, field: hist }
op: crosses_above
rhs: { value: 0 }
dir: longBollinger Bands
bollingerA moving average wrapped in volatility bands (± N standard deviations). Price tagging the lower band can flag a stretch ripe for a bounce, and band width shows how volatile conditions are.
- Parameters:
- period (20), std_mult (2.0)
- Fields:
- mid, upper, lower
YAML
leaf:
lhs: { price: close }
op: lt
rhs: { indicator: bollinger, period: 20, field: lower }
dir: longStochastic Oscillator
stochasticStochastic oscillator — where the close sits within the recent high–low range, shown as %K and a smoothed %D (0–100). Below 20 is oversold, above 80 overbought; %K crossing %D times entries.
- Parameters:
- period (14), smooth_d (3)
- Fields:
- k, d
YAML
leaf:
lhs: { indicator: stochastic, field: k }
op: crosses_above
rhs: { indicator: stochastic, field: d }
dir: longAverage Directional Index (ADX)
adxAverage Directional Index — measures trend strength (not direction) on a 0–100 scale, with +DI/−DI giving direction. Above ~25 signals a real trend; pair with +DI above −DI for an up-bias.
- Parameters:
- period (14)
- Fields:
- adx, plus_di, minus_di
YAML
leaf:
lhs: { indicator: adx, period: 14, field: adx }
op: gt
rhs: { value: 25 }
dir: longAverage True Range (ATR)
atrAverage True Range — the average size of a bar's range, i.e. how much price typically moves. Used mainly to size stops and targets to current volatility (e.g. stop = entry − 2×ATR).
- Parameters:
- period (14)
- Fields:
- value
YAML
# ATR is typically used for stop sizing, e.g.
risk:
stop: { anchor: atr, indicator: atr14, mult: 2.0 }ATR (smoothed)
atr_smaA smoothed ATR — the simple moving average of ATR — giving a steadier volatility baseline. Compare raw ATR against it to tell expanding volatility from contracting.
- Parameters:
- atr_period (14), sma_period (14)
- Fields:
- value, atr
YAML
leaf:
lhs: { indicator: atr, period: 14, field: value }
op: gt
rhs: { indicator: atr_sma, atr_period: 14, sma_period: 14, field: value }
dir: longVolume-Weighted Average Price (VWAP)
vwapVolume-weighted average price — the average price paid, weighted by volume and anchored to a session, day, week or month. Above VWAP, buyers are in control; it's a common fair-value reference and mean-reversion magnet.
- Parameters:
- anchor (session), period (20)
- Fields:
- value
YAML
leaf:
lhs: { price: close }
op: gt
rhs: { indicator: vwap, anchor: session, field: value }
dir: longVolume Moving Average
volume_maA moving average of volume — your baseline for 'normal' participation. Volume well above its average (e.g. 1.5×) confirms conviction behind a breakout.
- Parameters:
- period (20)
- Fields:
- value
YAML
leaf:
lhs: { price: volume }
op: gt
rhs: { indicator: volume_ma, period: 20, field: value }
dir: longDonchian Channel
donchianDonchian channel — the highest high and lowest low of the last N bars. A close above the upper band is a classic breakout entry; the mid-line acts as a trend reference.
- Parameters:
- period (20)
- Fields:
- upper, lower, mid
YAML
leaf:
lhs: { price: close }
op: gt
rhs: { indicator: donchian, period: 20, field: upper }
dir: longVolume Flow Indicator
vfiMarkos Katsanos's Volume Flow Indicator — a smoothed, volume-weighted oscillator that flips signs across the zero line as accumulation turns to distribution. Pair the histogram with a trend filter for confirmation entries.
- Parameters:
- length (130), coef (0.2), vcoef (2.5), signal_length (5), smooth_vfi (false)
- Fields:
- vfi, signal, hist
YAML
leaf:
lhs: { indicator: vfi, length: 130, field: hist }
op: crosses_above
rhs: { value: 0 }
dir: longSwing High / Low
swingRecent swing pivots — the last confirmed high and low plus the prior pair. Building blocks for breakout entries (close above the last high) and higher-high / higher-low trend filters.
- Parameters:
- lookback (1)
- Fields:
- last_high, last_low, prev_high, prev_low
YAML
leaf:
lhs: { price: close }
op: gt
rhs: { indicator: swing, lookback: 5, field: last_high }
dir: longStructural Trend
s_trendStructural trend state (+1 up, −1 down, 0 neutral) derived from confirmed swing breaks — it flips only after two same-side breakouts, filtering noise. A lightweight regime filter.
- Parameters:
- lookback (2)
- Fields:
- value
YAML
leaf:
lhs: { indicator: s_trend, lookback: 2, field: value }
op: eq
rhs: { value: 1 }
dir: longSuperTrend
super_trendThe textbook SuperTrend — ATR-banded trailing stop on hl2. `state` flips between +1 and -1 only on a close beyond the opposite band.
- Parameters:
- atr_period (10), factor (3.0)
- Fields:
- trail, state
YAML
leaf:
lhs: { indicator: super_trend, atr_period: 10, factor: 3.0, field: state }
op: eq
rhs: { value: 1 }
dir: longTrend Magic
trend_magicATR-ratchet trailing stop gated by CCI. The trail only ratchets toward price when CCI agrees with the prevailing direction — quieter than SuperTrend in chop.
- Parameters:
- period (20), atr_period (5), coeff (1.0)
- Fields:
- trail, state, cci
YAML
leaf:
lhs: { bar: close }
op: gt
rhs: { indicator: trend_magic, atr_period: 5, atr_mult: 1.0, field: trail }
dir: longBlack Flag Futures Trading System
blackflag_ftsSuperTrend variant by Black Flag. Uses a modified True Range and adds a three-step Fibonacci pullback ladder (38.2 / 50 / 61.8) for partial-take or scaled re-entries inside an ongoing trend.
- Parameters:
- atr_period (28), atr_factor (5.0), trail_type (modified), fib1 (0.618), fib2 (0.786), fib3 (0.886)
- Fields:
- trail, extreme, state, fib1, fib2, fib3
YAML
leaf:
lhs: { indicator: blackflag_fts, atr_period: 14, atr_factor: 1.6, field: state }
op: eq
rhs: { value: 1 }
dir: longEMA Pullback
ema_pullbackA complete long-&-short entry model: three EMAs set the trend and regime, then it waits for a pullback (within tolerance) and an ATR-gated trigger before firing long_signal / short_signal.
- Parameters:
- ema_fast (100), ema_slow (200), ema_regime (500), atr_period (14), atr_sma (50), atr_mult_long (1.0), atr_mult_short (1.5), pullback_tol_pct (0.1), max_wait_bars (50)
- Fields:
- long_signal, short_signal, ema_fast, ema_slow, ema_regime, atr, wait_long, wait_short
YAML
leaf:
lhs: { indicator: ema_pullback, field: long_signal }
op: eq
rhs: { value: 1 }
dir: longMarket structure (BOS / CHoCH)
market_structureDetects pivots and emits a Break of Structure or Change of Character on each pivot break. The `state` field carries the current regime so you can use it as a stateful trend filter.
- Parameters:
- swing_length (50)
- Fields:
- state, bos_signal, choch_signal, pivot_high, pivot_low
YAML
leaf:
lhs: { indicator: market_structure, swing_lookback: 5, field: bos_signal }
op: eq
rhs: { value: 1 }
dir: longOrder block
order_blockLast opposite-coloured candle before a Break of Structure. The block stays armed until price retests it (`bull_retest`) or sweeps through it (`bull_mitigated`).
- Parameters:
- swing_length (10)
- Fields:
- bull_top, bull_bottom, bear_top, bear_bottom, bull_signal, bear_signal
YAML
leaf:
lhs: { indicator: order_block, swing_lookback: 5, field: bull_retest }
op: eq
rhs: { value: 1 }
dir: longFair Value Gap (FVG)
fair_value_gap3-bar imbalance: a gap between bar[n-2]'s wick and bar[n]'s wick. Tracks the zone until price fills it; `bull_signal` fires on formation, `bull_filled` fires when the gap is closed.
- Parameters:
- min_gap_pct (0)
- Fields:
- bull_top, bull_bottom, bear_top, bear_bottom, bull_signal, bear_signal
YAML
leaf:
lhs: { indicator: fair_value_gap, min_gap_pct: 0.1, field: bull_signal }
op: eq
rhs: { value: 1 }
dir: longEqual highs / lows
equal_highs_lowsLiquidity-pool detector. Marks a level when consecutive highs (or lows) sit within `tolerance_pct` of each other. `eqh_swept` fires the bar the level is taken out — a common stop-hunt reversal trigger.
- Parameters:
- swing_length (3), threshold (0.1), atr_period (200)
- Fields:
- eqh_level, eql_level, eqh_signal, eql_signal
YAML
leaf:
lhs: { indicator: equal_highs_lows, lookback: 10, field: eqh_swept }
op: eq
rhs: { value: 1 }
dir: shortPrior period levels (PDH / PDL / PWH / PWL …)
prior_period_levelsPrior-day, prior-week, and prior-month open / high / low / close. Computed off the bar timestamp — no parameters. Useful for break-of-prior-period momentum and mean-reversion-to-prior-close trades.
- Parameters:
- none
- Fields:
- pdh, pdl, pwh, pwl, pmh, pml
YAML
leaf:
lhs: { bar: close }
op: gt
rhs: { indicator: prior_period_levels, field: pdh }
dir: longMulti-timeframe
Add `timeframe: '4h'` to any indicator spec to compute it on a higher timeframe and have the value re-broadcast onto your strategy's base bars. The engine handles the resampling — you keep writing rules against bars on your chosen base interval.
Example
leaf:
lhs: { indicator: rsi, period: 14, timeframe: '4h' }
op: lt
rhs: { value: 35 }
dir: longWarmup & NaN handling
Indicators emit NaN until they have enough bars to be honest about their output. A NaN-bearing leaf returns False — it does not error, it just abstains. This means new strategies might sit idle for the first N bars of a backtest; that is correct.