Navigation: Realtest Script Language > Syntax Element Details >







Strategy Elements


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


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

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

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

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


Using ThisClose with ExitLimit equivalent to adding "and C > n", where "n" is the ExitLimit 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 ExitLimit orders, the trigger price is calculated using the prior bar, and the order can be placed in advance.

A Intraday ExitLimit is a standard LMT DAY order.

A NextOpen ExitLimit is a MKT order that is placed if the prior close touched the limit price.

A NextClose ExitLimit is a LOC (limit on close) order at the specified limit price.

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 limit price, use PrevExitLimit in the ExitLimit price calculation.

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





Copyright © 2020-2024 Systematic Solutions, LLC