If you are a wannabe algorithmic trader then it is highly recommended to get strong knowledge on how the different types of orders work and the impact of their usage in Algorithmic Trading.
Stock Exchange is the place to find buyers and sellers and traders can find buyers and sellers using their trading orders. we can classify any type of order as
1)Active Orders – Orders which moves the market/price
2)Passive Orders – Order which is looking for a buyer or seller and doesn’t move the price
Active Orders are Market Orders which find the liquidity (Limit Orders) from the Orderbook. Active orders seek immediate buyers/sellers and do transactions at the best available bid x ask levels.
Passive orders generally Limit Orders provide liquidity to the markets. They don’t move the markets but sits in the exchange order book and wait for the fills.
What is OrderBook?
Orderbook is the electronic table maintained by the exchange which contains pending limit orders and shows the buyers willing to buy and sellers willing to sell at various levels. When comes to Indian Exchanges most of the brokers show Top 5 Buyers and Sellers who are providing the best quotes near the last traded price (Level 2 Data) and very few brokers up to 20 levels of Top Bid and Ask levels.
Market Orders consume liquidity (Market Taker) and are used for immediate execution. The opponent of a Market order is always a Limit order from the Best Quoted Prices from the orderbook. However, Market Order doesn’t guarantee the price of execution.
If you are placing 100 shares of Reliance Buy MKT order then exchange matches the MKT order with the best available seller quotes (LMT sell order – Ask price) from the orderbook.
If you are placing 100 shares of Reliance Sell MKT order then exchange matches the MKT order with the best available buyer quotes (LMT Buy order – Bid Price) from the orderbook.
Remember the famous saying, “Sellers hit the bid and Buyers lift the offer”
Market Orders and Slippages
As the Market Orders have an impact on the price when a large amount of market order is placed it could move the price depends upon the liquidity on the sell-side. If the market has lesser liquidity then a Market order can push the price to a greater extent and that could cause huge slippages in your trading system. This means the trader will end up paying more than the actual.
For example, if your trading system is generating a buy signal on the Last traded price 2525.60 in Reliance. However, when you punch 100 shares of the Market Order it gets executed at 2525.80. i.e 0.20 higher than the generated signal due to the next best available sell limit order at 2525.80.
This means the trader had paid 0.20 x 100 = Rs 20 extra while initiating this transaction compared to the generated Buy Signal.
Limit Orders supply liquidity to the orderbook and provides immediacy to the Market Orders. Limit orders displayed in the orderbook are pending orders which are waiting for the Market Orders to fill at a particular price. When the Limit Price is touched by the MKT orders then execution is guaranteed. If Limit Price is far from the LTP price then the Limit Orders will be in the pending state.
When the market starts you will be finding quotes displayed on both the buy and sell-side right from the start of the day till the end of the day across most of the trading instruments. They are liquidity providers mostly high-frequency trading firms and institutions that provide liquidity aka liquidity providers who are always on the other side of the trade of the Market Order.
High-Frequency Trading firms who supply liquidity on both sides also called Market Makers
One can Send Pending Buy Limit Orders below the Last traded price and Pending Sell Limit Orders above the Last traded price.
If the trader attempt to send Buy Limit Orders above the Last traded price or Sell Limit Order below the last traded price then it becomes a marketable order and executes with the characteristics of Market Order and instantly the order gets executed and consumes liquidity from the orderbook.
From an Algorithmic trader’s perspective, Limit orders will have zero slippages. However, Limit orders guarantee execution only if the Limit Price is touched until then the Limit orders will be in a pending state.
Stoploss orders are a special type of orders maintained by the exchange in a separate electronic table called a stop-loss book. Stop Loss orders are stored in this book till the trigger price specified in the order is reached or surpassed. When the trigger price is reached or surpassed, the order is released in the Regular lot book.
One can Send Stoploss Buy Orders above the Last traded price and Stoploss Sell Orders below the Last traded price.
If the trader attempt to send Stoploss Buy Orders below the Last traded price or Stoploss Sell Order above the last traded price then it becomes a marketable order and executes with the characteristics of Market Order and instantly the order gets executed and consumes liquidity from the orderbook.
There are two types of Stoploss Order
(i) Stoploss – Market Order
Stoploss Market Order contains a trigger price. When the Stoploss Market Order is placed with trigger price it sits in the stop-loss book which is maintained by the exchange and none of the traders have visibility over the stoploss book but the visibility is limited only to the orderbook.
If the trigger price is touched then the order gets executed as a regular market order and guarantees execution but not the price of execution. Hence, Stoploss Market Orders are prone to slippages and have the potential to move the markets and in certain cases could event lead to freak trades as well.
If the trigger price is jumped then the stoploss order will not get executed and still sits in the stoploss order book waiting for the trigger price level to touch to guarantee execution. It could happen because of low liquidity and high volatile market conditions some times trigger price might get skipped without touching the limit order and hence the order might be left unexecuted.
Note: If you are trading in options or thin liquidity markets then it is highly recommended to place stop loss Limit Orders
(ii) Stoploss Limit Orders
Stoploss Limit order contains two price
1)Limit Price – trade execution price level
2)Trigger Price – Price if touched then it looks for execution.
For Buy Stoploss Order the Trigger price <= Price
For Sell Stoploss Orders the Trigger price >= Price
This order type gives you a range of the Stop-Loss. Stop-limit orders are similar to stop-loss orders. But as their name states, there is a limit on the price at which they will execute
Let’s assume if you have a Short position in HDFCBank at 1560, then you will keep a Buy SL to limit losses. You will place a Buy SL order with price and trigger price. Since your order needs to be triggered first, (the trigger price ≤ price.) Here, this order type gives you a range of stop-loss.
Let’s assume a range of Rs.2. Here, you can keep trigger price = 1578 and price = 1580. When the price of 1578 is triggered, the buy limit order is sent to the exchange and your order will be squared off at the next available offer below 1580. So, your SL order may get executed between 1578 – 1580 but not above 1580.
If the trigger price – price range is touched only in that case Stoploss-Limit Order is sent to the exchange and your order will be executed at the next best available quote from the orderbook.
If the trigger price – price range is jumped then the stoploss order will not get executed and still sits in the stoploss order book waiting for the trigger price level to touch. It could happen because of low liquidity and high volatile market conditions some times trigger price might get skipped without touching the limit order and hence the order might be left unexecuted.
Stoploss order limits the slippages based on the range of stoploss provided as the trade execution itself gets limited to price – trigger price range
As the Stoploss order has a range of stoploss compared to stoploss market order the probability of execution is higher in stoploss order compared to the stoploss market order in a high volatile fast-moving market environment.
Risks of a Stop-Limit Order
While a stop-limit order can limit losses and guarantee a trade at a specified price, there are some risks involved with such an order. The risks include:
1. No Execution
A stop-limit order does not guarantee that the trade will be executed, because the price may never beat the limit price. If the limit order is attained for a short duration, it may not be executed when there are other orders in the queue that utilize all stocks available at the current price.
2. Partial Fills
Partial fills may occur when only a part of the shares in the stock order is executed, leaving an open order. Executing parts of a single order for each trading day the execution occurs will involve multiple commissions, which reduces the overall returns of a trader.