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`. |
| 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 | period (20, rolling window) | value | Fair-value reference. `close > vwap` = above-average price. |
| volume_ma | period (20) | value | Breakout confirmation. `volume > volume_ma * 1.5`. |
| trend | period (50), slope_lookback (5) | value (-1 / 0 / +1) | Categorical trend filter. `trend == 1` for uptrend, `== -1` for down. |
| 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. |
| s_trend_valid | lookback (1) | value (-1 / 0 / +1) | Same as s_trend but each breakout must be confirmed by the next bar's close. |
| 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. |
| 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.
Black 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 (14), atr_factor (1.6), fib_lookback (8)
- 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: 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:
- cci_period (20), atr_period (5), atr_mult (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: 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), v_coef (2.5), signal (5)
- Fields:
- vfi, signal, hist
YAML
leaf:
lhs: { indicator: vfi, length: 130, field: hist }
op: crosses_above
rhs: { value: 0 }
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_lookback (5)
- Fields:
- state, bos_signal, choch_signal, pivot_high, pivot_low, last_pivot_high, last_pivot_low
YAML
leaf:
lhs: { indicator: market_structure, swing_lookback: 5, field: bos_signal }
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.0), expire_bars (0 = never)
- Fields:
- bull_top, bull_bottom, bear_top, bear_bottom, bull_signal, bear_signal, bull_filled, bear_filled
YAML
leaf:
lhs: { indicator: fair_value_gap, min_gap_pct: 0.1, field: bull_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_lookback (5), retest_tolerance_pct (0.1)
- Fields:
- bull_top, bull_bottom, bear_top, bear_bottom, bull_signal, bear_signal, bull_retest, bear_retest, bull_mitigated, bear_mitigated
YAML
leaf:
lhs: { indicator: order_block, swing_lookback: 5, field: bull_retest }
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:
- lookback (10), tolerance_pct (0.05)
- Fields:
- eqh_level, eql_level, eqh_signal, eql_signal, eqh_swept, eql_swept
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, pdo, pdc, pwh, pwl, pwo, pwc, pmh, pml, pmo, pmc
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.