Orders, Deals and Positions in cTrader
One of the unique features of cTrader is the domain model it uses for the execution of the trader’s orders. In this article, we will explain the three main concepts a trader needs to be familiar with in order to comprehend how orders are executed in cTrader. These concepts are the Orders, the Deals and the Positions. Now let’s explain what each of these does
An order is the intention of a trader to buy or sell an asset. An order is sent from the trader to the broker, usually through a trading platform, and explains what the user wants to trade and on which conditions. Below you can find a short reminder of the order types offered by cTrader.
Market Order — Market Range Order
A market order is an order that instructs a broker to buy/sell an asset immediately at the best available price. A simple market order does not place any restriction on price. This might result in a noticeable slippage between the quoted price and the executed price. Therefore, cTrader supports placing a market range to orders in order to limit possible slippage. In the case of a Market Range Order and insufficient liquidity, the order will be filled partially only until the price that respects the set limit.
A stop order is a market order that is executed when a certain price level is reached. A trader can set a trigger price through the order and the market order will be executed when the trigger price is reached. A buy stop order is always placed above the current market price and a sell stop order below.
A limit order is an order that will be executed when a price is reached but only at the limit or a better price. A limit order is a way to guarantee that you will not receive a worse price than what you request for. A buy limit order is always placed below the current market price and a sell stop order above.
Stop Limit Order
A stop limit order is a combination of a stop order and a limit order. The combination of the two orders offers to the investor much greater precision in executing the trade. Contrary to a stop order that is filled at the market price after the stop price has been hit, regardless of whether the price changes unfavorably, a stop limit order places an order that sets a limit to the price that the investor accepts for the order. While a Stop Order can lead to trades being filled at less desirable prices, combining it with the features of a Limit Order, the order is only filled, fully or partially, within the desirable range.
When traders orders are passed from cServer to the liquidity provider, they need to be executed based on the available market liquidity. One of the main features of cTrader is the support of partial fills. In case market conditions do not allow complete execution of an order e.g. not enough liquidity, partial fills allow an order to be filled only for the part that is possible based on the available liquidity and the requested order restrictions. If an order is filled partially then it remains active until canceled or expired and when market conditions allow this the rest of the remaining order is executed.
This results in an order being executed with more than one agreement between a buyer and a seller. In cTrader, all these agreements are called deals. A deal is the basic entity that describes a trading activity in cTrader and it is closely related to the rest of the entities, orders and positions. Also many orders can be aggregated into a single position e.g. when a trader increases the size or partially closes a position. Orders can be executed with one or more deals and positions are composed of one or more deals as well.
A position is the result of one or more executed orders. As a result, it is composed of one or many deals. From another angle, a position can be also viewed as an aggregation of deals. A position is opened in cTrader when an opening deal is executed. Subsequent deals associated with the position and in the same direction are considered opening deals (Note: Associating deals with positions is only required for Hedging Accounts. Netting accounts net all deals into a single position). Deals associated with the position but with opposite direction are considered closing deals. A position remains open as long as the total value of opening deals and closing deals is different. It closes when the total value of opening and closing deals becomes equal.
The diagram below allows you to visualize how the three different entities work together.
cTrader’s domain model has been designed to resemble order execution at an institutional level. It reflects the way that markets work and supports proper market execution by allowing partial filling of orders. Orders can be filled by many partial deals which at the end are aggregated to the user’s position. It also allows the users to know the details of their order execution, as well as support advanced trading functions.