Navigation: Realtest Script Language > Syntax Element Details > EntryLimit

Category

Strategy Elements

Description

Price to use when entering a position with a limit order

Input

Any formula specifying a price per share

Notes

The price returned by the EntryLimit formula is used to place a one-day limit order. For a long buy, the Low must be less than or equal to the limit price to potentially generate an entry. For a short sale, the High must be greater than or equal to the limit price.

If the opening price for a stock is at or beyond the limit price, then the the order is assumed to have been filled at the opening price, otherwise it fills at the limit price. Limit orders that fill at the open are assumed to have filled first when some entries have to be skipped due to position count or investment level caps.

If both EntryLimit and EntryStop are used, then the entry order becomes a stop+limit order. For this order to fill, both of these prices must be touched. The most common reason to use a stop+limit order is to avoid entries in a stop-based entry strategy where the opening gap is excessively large.

When a strategy includes an EntryLimit and/or an EntryStop formula, all entry-related formulas are evaluated using the prior day as the current bar, so that there can be no possibility of a look-ahead error. EntrySetup is evaluated first, and no other entry formulas are evaluated if it returns 0. (The only exception to this is when EntryTime is ThisClose, which assumes a live data feed would be used to enter just before the close.)

If the EntryLimit formula returns 0, then entry will not occur (even for shorts). This makes it possible to include conditional logic in the limit price formula using, for example, the IIF function, as in iif(my_condition, my_limit_price, 0).

Examples

Enter long when price drops 4% below yesterday's close: EntryLimit: C * 0.96

Enter short when price touches an upper Bollinger Band: EntryLimit: BBTop(20, 2)

Enter long when RSI(2) reaches 5: EntryLimit: RRSI(2,5)

Copyright © 2020-2022 Systematic Solutions, LLC