Skip to content

Order Rules

Remember that algotrading is made up of the words algo (or algorithmic) and trading. And let us remember that because it seems that the trading part is forgotten more often than not. And if not forgotten it is undervalued.

A classic example of what some newcomers say:

  • "Hey, I tried an algorithm and issued some buy/sell orders and the execution price was not the price I wanted. I checked and I am using Market orders. What is happening?"

Ok, all algotraders have at some point been newcomers, but being new and disregarding things like order execution types is close to suicidal.

Brokers/Exchanges/Forex Shops et al. offer an ample selection of order execution types. And each is suited for a given situation and scenario. And not all order execution types are suited to the strategy and its goals.

One needs to carefully evaluate which order execution types to use and its fitness for the purpose, check the availability at the given Broker/Exchange/Shop and with all factors in the hand ... make a decision about using execution type to use (a single strategy may feature different execution types for the entry and exit stages for example)

Some Order Execution Types

Take the following into account when traversing and examining the list below.

  • These are generic order execution types with generic names. They may match or closely resemble what the broker/exchange/shop offers, but it does not necessarily have to be the same

  • There can be more than those listed below and not all of them may be available

  • Understand the types, but understand even better what you get from the provider

  • Consider that some of the execution types may be simulated by the provider, as in orders which have been sent but are kept in the broker systems and are only forwarded to the exchange when a condition is met.

    It can be either a disadvantage or an advantage depending on the goals.

Market

As the name points out this order lets the Market decide at which price the execution is going to take place.

Although it may sound crazy to let the market do it, because it can produce slippage, it can be an appropriate tool in very liquid markets to quickly enter/exit the market. A retail trader is not, possibly and probably, going to inject a buy/sell volume which cannot be absorbed at the current price without moving the prices.

On the other hand on non-liquid markets or markets when the spread between the buy/sell side is huge, letting the market decide what the price is going to be ... it's not the best option

Limit

With this order execution type, one sets the price limit at which one can be matched. This means

  • For a buy order, the execution price cannot be greater than the limit (but it could be less than)

  • For a sell order, the execution price cannot be less than the limit (but it could be greater than)

For both the buy and the sell side, it has been pointed out that the price can be better. This is unlikely to happen when the execution takes place during the session. But when a Limit order is set to be valid across several sessions, a gap in the open price can actually, from a practical point of view, provide an improved execution price.

MarketOnClose (MOC)

The order is set to be executed when the market closes like a Market order, i.e.: the market will set the price. Many exchanges run an auction in which the final price of the session is set. A MOC order will be executed (if enough market volume is there to fill the order), with the auction-agreed price.

MarketOnOpen (MOO)

The counterpart of MarketOnClose. This is set to execute as a Market order with the opening price.

Stop

Note

From the very beginning: DO NOT confuse Stop, the order execution type with the concept of stop-loss. This order execution type can obviously be used to exit a position minimizing losses, but it can also be used for entering the market.

A Stop order has 2 stages

  1. Trigger Phase - controlled by the trigger price. The Stop order remains, so to say, suspended until the trigger price is met.

  2. Market Phase - once the trigger has been pulled, the Stop order is executed as if it had been introduced as a Market order. Read the reference above about Market orders to understand what this implies.

Usually, for a typical stop-loss scenario:

  • A long position was open with a buy order at price pbuyand the trader wants to protect the position with a stop, taking minimal losses if the market does not move to the upside

  • A Stop Sell order is issued with trigger price pstop below pbuy, i.e.: pstop < pbuy

  • If the market goes downwards, pstop will be met and the order will be executed. If the market is very liquid and volatility is not crazy, one can assume that the execution price will be pstop and the losses will be (pbuy - pstop) * number_of_assets (and the round-trip commissions paid)

StopLimit

A StopLimit, just like a Stoporder has 2 stages

  1. Trigger Phase - controlled by the trigger price. The StopLimit order remains, so to say, suspended until the trigger price is met.

  2. Limit Phase - once the trigger has been pulled, the StopLimit order is executed as if it had been introduced as a Limit order. The limit price is different than the trigger price, i.e.: two prices are specified for this order. Read the description of the Limit order

StopTrail

It can be regarded as a Stop order with one difference

  • The trigger price trails the market price at a given distance (using an absolute value as the distance to maintain or a percentage value)

    The trigger price can only move in one direction. Example:

    • A StopTrail Sell is set at price pstop at a distance of 0.50 units of the asset price.

    • If the asset price moves upwards by 3.0 units, pstop moves up by 3.00 units to keep the distance at 0.50

    • If the asset price moves downwards by 0.20 units, the distance is reduced by 0.20, effectively reducing the final distance to 0.30 units

  • Once the trigger price is met, the Market part of the order is activated

StopTrailLimit

It works as a StopTrail order, but with an additional limit price.

  • The limit price is also recalculated following the rules laid out above for the trigger price

  • Once the trigger price is met, the Limit part of the order is met.

MarketIfTouched (MIT)

Similar to a Stop order, when the trigger price is met the order will be executed as if it were a Market order.

The difference with a Stop order

  • A Stop buy is placed above the current price level

  • A MIT buy order is placed below the current price level

    I.e.: the MIT buy order is used to wait for a market drop before entering the market at a price below the current level

LimitIfTouched (LIT)

Similar to a StopLimit order, when the trigger price is met the order will be executed as if it were a Limit order, using the second price specified when creating the order.

The difference with a Stop order

  • A StopLimit buy is placed above the current price level

  • A LIT buy order is placed below the current price level

    I.e.: the LIT buy order is used to wait for a market drop before entering the market at a price below the current level

OCO (Once Cancel Others)

Also known as OCA (One Cancel All). In this case a set of orders is linked together to form an order group. And the following holds true:

  • If one of the orders in the group is executed, the other orders are automatically canceled

A potential scenario:

  • The market has been flat for a while and the trader believes a sudden move either upwards or downwards is going to happen. To avoid guessing the following is done:

    • A Stop Buy order is prepared with a trigger price above the current price level

    • A Stop Sell order is prepared with a trigger price below the current price level

    • Both orders are sent to the market as an OCO group

  • When the market, as expected by the trader, suddenly moves in a direction, one of the orders will be executed and the other will be correspondingly canceled.

As stated above, some order types are sometimes simulated by the brokers. Consider the following scenario when using OCO orders if a simulation is in place

  • An order is executed in the exchange

  • Because the OCO functionality is being simulated by the broker, the broker can only issue the cancellation request when first notified of the execution.

  • When the cancellation request finally hits the exchange, extra orders in the OCO group may have been executed.

Unlikely to happen, but it may.

Bracket Orders

Also known as Take-Profit + Stop-Loss orders. The scenario

  • A buy main order to enter the market is prepared (an order which contains a Limit component)

  • Two (2) additional orders are prepared and linked to the main order as brackets (or children) of it. These orders will be

    • A Stop sell (or a StopXXXX variant) order located below the entry price to serve as a stop-loss order

    • A Limit sell order located above the entry price to serve as a take-profit order

  • The three (3) orders are submitted to the market with this happening

    • The main order is activated and awaits execution

    • The bracket orders are in the market but suspended awaiting the execution of the main order

    • When the main order is executed, the two brackets order are activated and will behave like an OCO group, i.e.: the execution of the stop-loss order will cancel the take-profit order and vice-versa

This scheme is supported by some brokers by simply:

  • Letting the trader specify a stop-loss level (in price or money terms) and a take-profit level (also in price or money terms)

  • It may also be possible to simply issue the stop-loss or take-profit part along with the main order.