Navigation: Realtest Script Language > Syntax Element Details >







Strategy Elements


Specifies how a strategy exits positions when the ExitStop formula is used


ThisClose - exit at today's close if today's closing price touches or exceeds the stop price (impractical)

Intraday - ExitStop specifies the price of a live stop order to be placed tomorrow (default)

NextOpen - exit at tomorrow's open if today's close touched or exceeded the stop price

NextClose - exit at (or just before) tomorrow's close if tomorrow's close touches or exceeds the stop price (calculated from today's bar)


Using ThisClose with ExitStop equivalent to adding "and C < n", where "n" is the ExitStop price (for a long-side strategy), to the ExitRule of a strategy with ExitTime ThisClose. In either case, orders could not be generated in advance for this mode.

With Intraday, NextOpen, or NextClose ExitStop orders, the trigger price is calculated using the prior bar, and the order can be placed in advance.

A Intraday ExitStop is a standard STP DAY order.

A NextOpen ExitStop is a MKT order that is placed if the prior close touched the stop price.

A NextClose ExitStop is a STP order with a "good after time" clause with time a minute or two before the market closes.

Note that the Exit Logic of a strategy works differently from its Entry Logic. Specifically, there is always only one Entry order, while there can be up to three Exit orders. The three exit order types each have their own time specifier and function as a "one-cancels-all" order bracket, where the order to logically trigger first becomes the position exit and the others do not.

To implement a trailing stop price, use PrevExitStop in the ExitStop price calculation.

For more information on how the backtest engine works in general, see Backtest Engine Details.





Copyright © 2020-2024 Systematic Solutions, LLC