Trail

forge.signalsclassSince Forge API 1
Signaturepython
forge.signals.Trail(*,kind: str,note: str | None = None,value: float | np.ndarray | None = None,mult: float | None = None,length: int | None = None,start_pips: float | None = None,start_points: float | None = None,start_r: float | None = None,step: float | None = None,max: float | None = None) -> None

A stop that follows the price. Build one with a constructor, like fg.Trail.atr(3.0).

Parameters

NameTypeDefault
kindstr
notestr | NoneNone
valuefloat | np.ndarray | NoneNone
multfloat | NoneNone
lengthint | NoneNone
start_pipsfloat | NoneNone
start_pointsfloat | NoneNone
start_rfloat | NoneNone
stepfloat | NoneNone
maxfloat | NoneNone

Members

NameSignatureSummary
atr(mult: float, length: int = 14, *, start_r: float | None = None, step: float | None = None, note: str | None = None) -> TrailTrail a multiple of the average true range, from ``start_r`` times the risk ahead.
chandelier(mult: float = 3.0, length: int = 22, *, note: str | None = None) -> TrailThe chandelier exit: a multiple of the average true range from the best price.
pct(value: float, *, note: str | None = None) -> TrailTrail a percent of the price behind the best price, below 100.
pips(value: float, *, start_pips: float | None = None, step: float | None = None, note: str | None = None) -> TrailTrail ``value`` pips behind the best price, from ``start_pips`` ahead, in ``step``s.
points(value: float, *, start_points: float | None = None, step: float | None = None, note: str | None = None) -> TrailTrail ``value`` points behind the best price, from ``start_points`` ahead, in steps.
psar(step: float = 0.02, max: float = 0.2, *, note: str | None = None) -> TrailThe parabolic SAR: ``step`` is the acceleration, ``max`` its top, at most 1.
series(level: np.ndarray, *, note: str | None = None) -> TrailFollow a level you compute, one price per bar. The stop is that level for both sides.

pips and points trail at a fixed distance, starting once the trade is that far ahead (start_pips, start_points) and moving in steps of step. atr trails at a multiple of the average true range, from start_r times the risk. pct trails at a percent of the price. chandelier and psar are the named trailing methods, and series follows a level you compute, one value per bar.