Indicator

forge.indicatorclassSince Forge API 1
Signaturepython
forge.indicator.Indicator(**inputs: Any) -> None

The one base class of an indicator (IND-001: declared by subclassing, never inferred).

Parameters

NameType
**inputsAny

Non-time bars: an indicator runs on whatever bars it is given. bars.kind and bars.params say which (bars.kind == "renko"); bars.close is the drawn price and bars.real.close the real one. Sessions, daily levels and anchored averages read bars.real.time and bars.volume (the real volume inside each bar). The forming brick is never part of bars in a test. How candles are drawn (a Heikin-Ashi style) is a chart setting and never changes bars; an indicator reads the data's bar type, not a display style.

Bar form: a negative offset is refused when the file is checked and when it runs.

Warm-up: recursive indicators (exponential averages, Wilder smoothing) keep a memory of where their data started. Each built-in's settle length in the registry is the history after which more bars change its value by less than 0.1% of its range. An anchored indicator (a running total) depends on its first bar.

Repainting: set repaints = True when your indicator changes values it already showed (a swing marked once it is confirmed, for example). Forge then feeds strategies the value as it was at each bar's close. Mark an output that deliberately reads later bars, such as a training label, with causality_exceptions = {"target": "ml_label"}: the check reports it, and strategies cannot read it.

Used in