跳转至

Indicators Reference

Technical indicator facade for pandas-ta-classic, TA-Lib, TDX, and TradingView styles.

Back to API Reference

Generic technical indicator namespace.

The default ta.* functions are thin wrappers over pandas-ta-classic. Same-name indicators may differ from future ta.tdx and ta.tv namespaces. Choose the namespace for the market convention you need.

FunctionIndicator

Callable indicator wrapper with batch and streaming entry points.

For streaming use (on_bar), pass bar_columns to declare which OHLCV fields the function needs. Each call to on_bar appends to a streaming state buffer and recomputes over the full history — correct but O(n).

Module-level instances such as ta.sma are shared. Use new_state() and pass that state to on_bar when a streaming indicator is used by a long-lived strategy or event loop.

__call__

__call__(*args: Any, **kwargs: Any) -> pd.Series | pd.DataFrame

Compute the indicator over a batch of data.

compute

compute(*args: Any, **kwargs: Any) -> pd.Series | pd.DataFrame

Compute the indicator over a batch of data.

new_state

new_state() -> IndicatorState

Create an isolated streaming state for this indicator.

on_bar

on_bar(bar: Any, *, state: IndicatorState | None = None) -> float | tuple[Any, ...]

Update from a single bar and return the current indicator value.

bar may be a StreamBar dataclass or any mapping with the required column keys. Recomputes over the full buffer each call.

reset

reset(*, state: IndicatorState | None = None) -> None

Clear streaming buffers.

Passing a state clears only that isolated state. Without a state, this clears the backwards-compatible default buffer used by direct on_bar calls.

Indicator

Protocol implemented by function-style indicators.

compute

compute(*args: Any, **kwargs: Any) -> pd.Series | pd.DataFrame

Compute an indicator over a batch of data.

on_bar

on_bar(bar: Any, *, state: IndicatorState | None = None) -> float | tuple[Any, ...]

Update an indicator from a single streaming bar.

__getattr__

__getattr__(name: str) -> Any

Lazily expose market-specific indicator namespaces.