Trading Orders - Part 1

Updated on 2009-11-03

In the process of generating and executing orders, several things must be checked or verified by the trader, the broker and the exchange. As an example, if a trading system tells you to buy a stock which is expected to perform well in the future, and at the same time, this stock is already present in your portfolio then you will have to make a decision. Should I reject the recommendation or add a buy order and scale-in my existing position?.
When you enter an order into your trading platform, your broker will perform several checks, he must make sure that the order is properly formatted, that you have enough cash... Then the order is transmitted to the exchange and is executed only if several other things are met. For example, if you transmit a limit order, and the limit price is not reached, your order will stay in the pending list until the limit price is met.

QuantShare backtesting engine was built to provide the most realistic and accurate simulation results. It simulates almost all verifications and checks performed by your broker and by the exchange.

Generating an order:
Before you start backtesting a strategy, you should specify its buy and sell rules. These rules, when they pass, will generate signals. At the end of each period (at the close price), all generated signals will be analyzed and the ones that pass the filtering process will be transformed into trading orders (Open market order, Close market order or Limit order). However, you may wonder how this filtering process works and why certain signals are transformed while others are simply ignored.

From a signal to an order:
The signals are generated at the end of each period. In case you use a daily backtesting timeframe, the end of period here refers to the end of day. The buy, sell, short and cover rules will be calculated and then the simulator will create a list of buy, sell, short and cover signals. A signal contains the symbols name, the current date (to track the signal later), the limit price if any, the stop orders type, price and re-enter value.

Why are some signals rejected?
First, we will not talk here about the money management scripting. This QuantShare feature allows you to take deep control over the simulation process and let you override almost any logic.

Before taking each signal individually and then analyzing it, the simulator will check whether the user has created a long or a short ranking system. A long ranking system deals with long signals (buy), while a short ranking system deals with short signals (short). These systems can be set by the user to tell the simulator which signals to analyze first.
Normally signals are sorted alphabetically by the symbol name, however, if you specify a simple formula; let us say "close" and set it as a ranking system for the trading strategy, the signals will be ordered by the close price of the signal's symbol.

For the sake of simplicity, we will only talk about buy signals (sell signals are easier to manage, and the logic behind short/cover signals is the same as the buy/sell signals).

Now that the simulator got an ordered list of signals, it will calculate the amount of available cash for the current day, as well as the number of available positions. The simulator then loops through each signal; the signal is either accepted or rejected, it depends on if it passes a set of filters or not.

Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.