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) -> NoneA stop that follows the price. Build one with a constructor, like fg.Trail.atr(3.0).
Parameters
| Name | Type | Default |
|---|---|---|
| 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 |
Members
| Name | Signature | Summary |
|---|---|---|
| atr | (mult: float, length: int = 14, *, start_r: float | None = None, step: float | None = None, note: str | None = None) -> Trail | Trail 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) -> Trail | The chandelier exit: a multiple of the average true range from the best price. |
| pct | (value: float, *, note: str | None = None) -> Trail | Trail 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) -> Trail | Trail ``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) -> Trail | Trail ``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) -> Trail | The parabolic SAR: ``step`` is the acceleration, ``max`` its top, at most 1. |
| series | (level: np.ndarray, *, note: str | None = None) -> Trail | Follow 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.