Navigation: Realtest Script Language > Syntax Element Details >

OrderMktAsLmtPct

 

 

 

 

Category

Strategy Elements

Description

Allows generated market orders to optionally be converted to limit orders X% beyond the last close.

Value

A number expressing the desired percentage, e.g. 3 for 3%, or 0 if no conversion is desired

Notes

The purpose of this strategy option is to allow what is logically a market-order to be executed as a marketable limit order.

This option provided to support order generation for exchanges that do not permit market orders, without having to convert the strategy to one that always uses limit orders.

Market orders are typically generated in the following situations:

entry orders when EntryTime is NextOpen (or omitted) and neither EntryLimit nor EntryStop is specified

exit orders when ExitRule is true and ExitTime is NextOpen (or omitted)

exit orders when ExitLimit touches the last close and ExitLimitTime is NextOpen

exit orders when ExitStop touches the last close and ExitStopTime is NextOpen

In all such cases, if OrderMktAsLmtPct returns a non-zero value then the order is converted to a LMT order.

For example, if 10 is the specificed percentage, then a long entry (buy) order would use Close * 1.1 as its limit price, and a long exit (sell) order would use Close * 0.9 as its limit price. The idea is to allow plenty of extra room to ensure a fill while still using a limit order.

To selectively apply this option, e.g. in a strategy that trades on multiple exchanges, use a formula such as:

This will tell RealTest to convert market orders to limit orders for stocks that trade on the ASX but not for stocks that trade elsewhere.

Note that this option only affects generated orders. Backtests still model the strategy with simple market order logic.

 

 

 

 

 

Copyright © 2020-2024 Systematic Solutions, LLC