Skip to content

Indicators

Signal helpers and provider indicators when supplied.

Start with the topic guide for worked examples. Signatures below show the available arguments.

barssince(condition: Any) -> int

Returns the number of bars since the most recent true value in the supplied condition history. Zero means true now. If none is true, returns the available history length; this is not evidence of a signal before that history. Supply history rather than only a current Boolean for a multi-bar count.

change(series: Any, n: int = 1) -> float

Returns series[0] - series[n] in the input's units; the default offset is one. Offset N needs N+1 values.

crossover(a: Any, b: Any) -> bool

True when a[0] > b[0] and a[1] <= b[1]. Supply series with current and previous values. A numeric constant may be a threshold; two current scalars do not preserve an earlier relationship. This is a transition, unlike a persistent greater-than comparison.

crossunder(a: Any, b: Any) -> bool

True when a[0] < b[0] and a[1] >= b[1]. Requires current/previous observations for series arguments. A strict equality now does not cross under.

falling(series: Any, n: int = 1) -> bool

True when each of the last N adjacent comparisons falls strictly. n=3 needs four values; equality breaks the test. n must be at least one.

highest(series: Any, n: int) -> float

Returns a scalar maximum over offsets 0 through n-1, including the current value. n must be positive and the full window must be available. Guard history before calling.

lowest(series: Any, n: int) -> float

Returns a scalar minimum over offsets 0 through n-1, including the current value. n must be positive and the full window must be available.

mean(series: Any, n: int) -> float

Returns a scalar arithmetic mean of the available recent values, up to n, including current. For a full-window rule, guard len(series) >= n; shorter warmup history can otherwise produce a partial-window mean.

pct_change(series: Any, n: int = 1) -> float

Returns (series[0] - series[n]) / series[n] as a fraction, with default offset one. 0.01 means 1%. A zero prior value returns zero; do not interpret that fallback as an observed zero return.

rising(series: Any, n: int = 1) -> bool

True when each of the last N adjacent comparisons rises strictly. n=3 needs four values; equality breaks the test. n must be at least one.

session_range(start: str, end: str) -> "Optional[SessionRange]"

Returns the current day's summary after the HH:MM window ends; otherwise None, including when the window contains no valid bars. Membership includes start and excludes end. Read .high, .low, .width, .mean_volume, .total_volume and .bars; .range/.avg_volume are TradeScript spellings. See trading hours.

stdev(series: Any, n: int) -> float

Returns a scalar sample standard deviation of the available recent values, up to n, using the available count minus one as divisor. Fewer than two values return zero. For [1, 2, 3], stdev(series, 3) is 1.0. A complete-window rule needs an explicit history guard. This helper is named stdev in Python and stddev in the TradeScript catalog.

Alpha Lab signals

The optional pinned alphalib adapter supplies these temporal calculations. Read Alpha Lab signals for installation, full-bar inputs, portfolio dictionaries and NaN behavior. Positive lookbacks count observations; the first usable reading also requires valid input values.

  • alpha.alpha_000(bars) — requires close, low; first possible usable observation 16; exact latest-value history 16 rows.
  • alpha.alpha_026(bars) — requires high; first possible usable observation 9; exact latest-value history 9 rows.
  • alpha.alpha_084(bars) — requires low, close; first possible usable observation 27; exact latest-value history 27 rows.

Indicator functions

These 42 base indicator names are supplied by the TAP integration. Read the Python indicator library for call forms, units and component names, or use TAP explicitly for imports and multi-line results. In Python pass the input explicitly, for example rsi(close, 14) or atr(bars, 14); TradeScript's period-only shorthand does not apply. Series-returning calls support [0] for now and [1] for the previous value. Multi-output base names may return containers; consult the Python result examples before treating a name as a numeric line. Helpers above can instead return scalars.

  • adx
  • alma
  • aroon
  • atr
  • awesome
  • bollinger_bands
  • cci
  • cmf
  • dema
  • donchian_channel
  • ema
  • force_index
  • highest_n
  • historical_volatility
  • hull_ma
  • kama
  • keltner_channel
  • lowest_n
  • macd
  • mfi
  • modified_rsi
  • modified_stochastic
  • momentum
  • obv
  • ppo
  • rmi
  • roc
  • rsi
  • sine_weighted_moving_average
  • sma
  • stc
  • stochastic
  • tema
  • trix
  • tsi
  • vidya
  • vwap
  • vwma
  • williams_r
  • wma
  • zero_lag_ema
  • zlema