May
2

Trading System 101 – Part 4 What Happen When My System Place A Market Order?

For many beginners, there is always confusion about the mechanism of order placement. I am going to provide more details about that in this article.

Understanding Update Scheme On Bar Completion

When an indicator is first loaded, it recalculates its historical values bar by bar (see the article Formula 201 – #10 Update Scheme (By Tick vs. On Bar Completion)). Since the historical data is static, every bar in the historical data are already completed by definition.

When orders are generated for a particular bar within the historical data, most simple trading applications will choose to record the closing price of that bar as the reference price, so that later on, the profit/loss and other statistics can be generated for the positions taken.

In real-time, however, the reference price recorded this way is both inaccurate and impossible to obtain due to the fact that the closing price is part of history, that cannot be and could not be filled by the order generated from this information.

In fact, not even the open price of the next valid bar is good for historical testing nor real-time usage because for most data series, the arrival of the first tick of a bar, that mark the open price, is also the signal of the completion of the previous bar. In turn, indicators are triggered by the arrival of this tick, to calculate the final values for the previous bars.

Orders are Filled on Next Valid Bar After the Arrival of First Tick

With NeoTicker, trading signals will generate orders only, whether they are generated from historical data or real-time data does not affect this behaviour, and these orders are not executed until the next valid bar.

Using the Fill Type Exact, NeoTicker will generate fill price for your market order at the open of the next valid bar. i.e. Buy At Market, Sell At Market, etc. This result is theoretical and useful for initial research only.

Once you dig deeper into a particular trading system, it is best to switch the Fill Type to Limited Worst Case to analyze the effects of slippage on the system.

For a very liquid market like Emini S&P, using fill type Limited Worst Case with 1 tick slippage, you can accurately predict the likely filled price for your market orders. Open price of the next bar is no longer the price that your market orders are filled with. Instead, you get 1-tick slippage against your order type so your system can account for the difference, especially when your system heavily depends on target orders and stop orders based on the entry price.

If your system is heavily curve fitted to the exact fill prices, the limited worst case setting can turn the result of your system upside down.

Why are My Market Orders Filled One Bar Late?

That is one of the most common questions we receive every week. New users who are trying their hands on writing their first few trading systems are always puzzled by the behaviour.

The real problem, usually lies with the use of crossover signals.

Crossover signals have some unexpected behaviours that can throw most people off guard.

An Example Chart Illustrating the Dilemma of Crossover Type Signals

Here is a chart with multiple crossovers.

20060501 chart

From the left side of the chart,

The first 2 crossovers clearly happened between the 2 bars where they occurred. Thus, it is clear the signals are generated on the bar right after the crossovers.

The 3rd crossover happened very close to the 2nd bar within the 2 bars range. The signal can still be detected when the 2nd bar was completed.

The 4th crossover is the one of interest – although it looks like the signal was generated on the 2nd bar where the crossover happened, the reality is that the signal actually happened right on the 2nd bar, thus it is only detectable upon the arrival of the 3rd bar.

To overcome the weaknesses of crossover delay, I have done research work in this area and the article Detecting Moving Average Crossover Before It Happens should help.

Epilogue

10 years ago, I did a presentation for our local technical analysis group, an informal introduction to systematic trading. During that time, there were not many choices to choose from in terms of retail technical analysis software. Pointing out the various deficiencies among those software created a huge reaction among the group. To overcome those software problems, I presented ways to calculate the corrected trading results using the limited worst case concept.

I still remember the faces of those who were in disbelieves, that their hard work with those programs did not really get them closer to what they are looking for, namely, their own profitable trading systems. I thought that was the right thing to do and I still think it is the right thing to do.

Discuss this article.

Leave a Comment

Blog Developed
By ContentRobot