Size
forge.signalsclassSince Forge API 1
Signaturepython
forge.signals.Size(*,kind: str,note: str | None = None,value: float | np.ndarray | None = None,annual: float | None = None,lookback: int | None = None,round: str = 'down') -> NoneHow much each entry trades. Build one with a constructor, like fg.Size.risk_pct(1.0).
Parameters
| Name | Type | Default |
|---|---|---|
| kind | str | |
| note | str | None | None |
| value | float | np.ndarray | None | None |
| annual | float | None | None |
| lookback | int | None | None |
| round | str | 'down' |
Members
| Name | Signature | Summary |
|---|---|---|
| fixed_margin | (value: float, *, round: str = 'down', note: str | None = None) -> Size | A position that uses this much margin, in the account currency. |
| lots | (value: float | np.ndarray, *, round: str = 'down', note: str | None = None) -> Size | A fixed number of lots, or one number per bar. |
| notional | (value: float, *, round: str = 'down', note: str | None = None) -> Size | A position of this value, in the account currency. |
| pct_equity | (value: float, *, round: str = 'down', note: str | None = None) -> Size | A position worth this percent of the account's equity. |
| risk_cash | (value: float, *, round: str = 'down', note: str | None = None) -> Size | Risk this much money, in the account currency, on each trade. |
| risk_pct | (value: float, *, round: str = 'down', note: str | None = None) -> Size | Risk this percent of the account on each trade, from the entry to the stop. |
| units | (value: float | np.ndarray, *, round: str = 'down', note: str | None = None) -> Size | A fixed number of units of the instrument, or one number per bar. |
| vol_target | (annual: float, *, lookback: int = 20, round: str = 'down', note: str | None = None) -> Size | Size so the position's yearly volatility is this fraction of the account, like 0.1. |
lots and units take a number or one per bar. The risk methods size the entry so the stop
loses that much, so they need a stop. round is "down" (the default, never above the
amount) or "nearest", to the broker's lot step.