Entry
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) -> NoneHow entries are placed: fg.Entry.market, limit, stop or stop_limit.
Parameters
| Name | Type | Default |
|---|---|---|
| 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 |
Members
| Name | Signature | Summary |
|---|---|---|
| condition | (self) -> np.ndarray | The 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) -> Entry | Place 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) -> Entry | Enter 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) -> Entry | Place 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) -> Entry | A 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.