Navigation: Realtest Script Language > Syntax Element Details >







Strategy Elements


Price to use when entering a position with a stop order


Any formula specifying a price per share


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

If the opening price for a stock is at or beyond the stop price, then the the order is assumed to have been filled at the opening price, otherwise it fills at the stop price. Stop 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 is when EntryTime is ThisClose, which implies that a live data feed would be used to enter just before the close.)

If the EntryStop formula returns 0, this means "always enter", i.e., it becomes a market order (or a simple limit order if EntryLimit was also specified).


Enter long when price moves above yesterday's high: EntryStop: H + TickSize

Enter short when price moves below a moving average: EntryStop: MA(C,20) - TickSize

Enter long if price moves above the 10-day highest close: EntryStop: Highest(C,10) + TickSize

Add a limit order to the prior example to avoid entry at more than 2% above the stop price: EntryLimit: 1.02 * Highest(C,10)




Copyright © 2020-2024 Systematic Solutions, LLC