Entry

forge.signalsclassSince Forge API 1
Signaturepython
forge.signals.Entry(*,kind: str,note: str | None = None,when: np.ndarray | None = None,price: np.ndarray | None = None,stop_price: np.ndarray | None = None,tif: str = 'gtc',tag: str | None = None,comment: str | None = None,alert_text: str | None = None,stop_loss: Stop | None = None,take_profit: Target | None = None,exit_when: np.ndarray | None = None,when_selection: tuple[str, int] | None = None) -> None

How entries are placed: fg.Entry.market, limit, stop or stop_limit.

Parameters

NameTypeDefault
kindstr
notestr | NoneNone
whennp.ndarray | NoneNone
pricenp.ndarray | NoneNone
stop_pricenp.ndarray | NoneNone
tifstr'gtc'
tagstr | NoneNone
commentstr | NoneNone
alert_textstr | NoneNone
stop_lossStop | NoneNone
take_profitTarget | NoneNone
exit_whennp.ndarray | NoneNone
when_selectiontuple[str, int] | NoneNone

Members

NameSignatureSummary
condition(self) -> np.ndarrayThe bars an order is placed on, as True/False.
limit(price: np.ndarray, *, tif: str | None = None, expire_bars: int | None = None, expire_at: int | datetime | None = None, tag: str | None = None, comment: str | None = None, alert_text: str | None = None, note: str | None = None) -> EntryPlace a limit order at ``price`` on each bar where it is a number.
market(when: np.ndarray | ConditionTree, *, tag: str | None = None, stop: Stop | None = None, target: Target | None = None, exit: np.ndarray | ConditionTree | None = None, comment: str | None = None, alert_text: str | None = None, note: str | None = None) -> EntryEnter at the next price on each bar where ``when`` is True.
stop(price: np.ndarray, *, tif: str | None = None, expire_bars: int | None = None, expire_at: int | datetime | None = None, tag: str | None = None, comment: str | None = None, alert_text: str | None = None, note: str | None = None) -> EntryPlace a stop order that triggers at ``price`` on each bar where it is a number.
stop_limit(stop_price: np.ndarray, price: np.ndarray, *, tif: str | None = None, expire_bars: int | None = None, expire_at: int | datetime | None = None, tag: str | None = None, comment: str | None = None, alert_text: str | None = None, note: str | None = None) -> EntryA stop-limit order: triggered at ``stop_price``, then a limit order at ``price``.

Pass one as long_entry or short_entry in fg.Signals. A market entry takes the usual True/False array. The priced kinds take an array of prices, one per bar: an order is placed on each bar whose price is a number, and a NaN bar places none, so write np.where(condition, level, np.nan). tif, expire_bars and expire_at limit how long a resting order waits. tag names the trade, and comment and alert_text ride with it.

Forge places these entries itself, on the bar each one fires, with the stop and target worked out from the order's own price. It calls the strategy's confirm_entry and size hooks for them in the order the engine calls them for any entry: confirm_entry first, then size.