Navigation: Realtest Script Language > Syntax Element Details >

EntryStop

 

 

 

Category

Strategy Elements

Description

Price to use when entering a position with a stop order

Input

Any formula specifying a price per share

Notes

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.

If the EntryStop formula returns 0, then entry will not occur (even for longs). 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_stop_price, 0).

Examples

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 prior 10-day highest close: EntryStop: Highest(C,10)[1] + 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)[1]

 

 

 

Copyright © 2020-2021 Systematic Solutions, LLC