跳转至

Indicators Reference

Qualified TA-Lib, TDX and TradingView indicators with stateful execution.

Back to API Reference

Persistent indicator sources.

Choose talib (default source), tv or tdx explicitly. Retired PTA and duplicate shortcut formulas are not imported, including through dynamic discovery.

FunctionIndicator

Callable indicator wrapper with batch and streaming entry points.

Streaming requires an explicit persistent implementation. Batch-only functions never silently recompute history. Use one new_state() per strategy/feed/symbol/timeframe; reset is required after parameter changes or a backend exception. Input buffers have a declared finite capacity.

minimum_period property

minimum_period: int

Minimum seed count under this exact parameter configuration.

supports_streaming property

supports_streaming: bool

Whether this object has an explicit persistent implementation.

__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.

configured

configured(**params: Any) -> FunctionIndicator

Return an independently configured adapter without mutating a singleton.

bind_stream

bind_stream(
    args: tuple[Any, ...], kwargs: dict[str, Any]
) -> StreamBinding

Bind original call inputs/parameters once for the shared Lines owner.

The caller retains the returned binding and advances update(*scalars) once per accepted input event. Accessing its value does not advance.

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, ...]

Advance an explicit persistent implementation exactly once.

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.

IndicatorState dataclass

Per-strategy streaming buffers for a function indicator.

clear

clear() -> None

Clear all streaming buffers.