Measuring slippage
Author: topcat77
Creation Date: 3/4/2009 9:14 PM
profile picture

topcat77

#1

I currently monitor slippage by comparing autotrade executions - listed in the Order file - against their theoretical equivalents obtained by backtesting strategies at the end of the day.This is a cumbersome process. Since both sets of data are in WL, is there a way to match them together ?


( I also have some observations/issues with latency - the time lapse between close-of-bar and execution - am I correct to assume that this is a Fidelity question and not for discussion here ?)
profile picture

Cone

#2
QUOTE:
Since both sets of data are in WL, is there a way to match them together ?
You've got price data, theoretical trade data from backtests, and TradeHistory.xml in the \Data folder. The process of calculating slippage should only be cumbersome once - writing the program to do it.

QUOTE:
the time lapse between close-of-bar and execution
There will always be a delay, but it will be up to 5 seconds longer for thinly-traded stocks. Fidelity streaming will "close the interval" as soon as a tick occurs in the next interval or 5 seconds after the heartbeat perceives the minute mark - whichever occurs first.

Note that in the first case, only one tick has occurred in the next interval, and in the second 5-second delayed case, a trade has not even occurred yet - so yours could be the first.
profile picture

topcat77

#3
QUOTE:
writing the program to do it.

is this "writable" in WL script? or do I need to export the data and (for example) run a macro routine in Exel?

QUOTE:
There will always be a delay, but it will be up to 5 seconds longer for thinly-traded stocks.


Fidelity ran a quick (and helpful) diagnostic on a sample of trade executions. Executions are taking place between 10-30 seconds after the close of the signal bars. That is quite enormous latency. In answer to questions about Strategies and the securities within each of them : I am running nine strategies, off 1 and 3 minute bars; each Strategy points to between 2 and 5 securities. The Strategies trade in only the v high-volume ETFs (so no thinly traded stocks). Fidelity thinks that almost all the delay derives from the data provider.

Two questions: first, does anybody know, or have experience of, a data source of superior speed ? (I am using the default Fidelity data)
Is there any other way that latency can be improved?

Second: if WL could support AtClose orders for short term bars, rather than only for close-of-market, this would substantially mitigate the problem (at least for entries) even at the risk of some missed trades.
Is this on the drawing board? Can it be put in a suggestion box ?

profile picture

Cone

#4
CODE:
Please log in to see this code.
Of course. Do it any way that you like!

CODE:
Please log in to see this code.
What is the 10-30 sec delay exactly? Is it between the end of bar and executing the order, or is it between getting an "Active" status and "Fill"? Why kind of orders? AtMarket? Which exchange?

There's no easy answer. There are many variables. But look, after the order is Placed, Wealth-Lab is done with its job. The rest is up to the "back end" trading subsystem and the exchanges, specialists, market markers, ECNs, etc.

QUOTE:
Fidelity thinks that almost all the delay derives from the data provider.
Have you noticed that your data is latent? It probably isn't. If I can get data from U.S. markets with less than 500 msec latency off the coast of Morocco, your data is probably getting to you even quicker. Just look at a TOS and compare it to your system's synchronized clock.

QUOTE:
Second: if WL could support AtClose orders
AtClose orders have no place in intraday trading strategies except (perhaps) at MOC - and then it's too late to get the order in. Again, the only difference between an AtMarket and AtClose order for intraday trading is 1 tick - and in the second case I cited, not even that. Don't waste your time here - there's absolutely zero practical difference in these orders for intraday.
profile picture

topcat77

#5
QUOTE:
is this "writable" in WL script?Of course. Do it any way that you like!

This is likely a well-worn need - would you know of any other WL autotraders who might have written a rough-and-ready script to compare executions with theoretical trade data from backtests?

QUOTE:
What is the 10-30 sec delay exactly? Is it between the end of bar and executing the order, or is it between getting an "Active" status and "Fill"? Why kind of orders? AtMarket? Which exchange?



The 10-30 second delay represents the difference between close of signal bar and the time as stated on Fidelity ATP as execution. All orders are AtMarket. All securities are most-actively traded Etfs on NYSe/Amex
(SPY, QQQQ, SDS, SKF, QID etc)

QUOTE:
Have you noticed that your data is latent

Agree, data doesn't seem latent on either WL or Fidelity ATP

QUOTE:
There's no easy answer. There are many variables. But look, after the order is Placed, Wealth-Lab is done with its job. The rest is up to the "back end" trading subsystem and the exchanges


Somewhere in the link : data-to-WL, WL-to-order, Order-to-execution there is process delay. Fidelity's observation is only that Order-to-execution occurs in less than 1 second. How can I dig deeper and troubleshoot this ? I would like to avoid having this nudge me off the platform

QUOTE:
AtClose orders have no place in intraday trading strategies except (perhaps) at MOC - and then it's too late to get the order in. Again, the only difference between an AtMarket and AtClose order for intraday trading is 1 tick -


Good in theory, not so good in practise. Virtually no WL/Fidelity trades execute at the "1 tick" difference. For interest I also run a custom-built Automated Trading System for futures; it transacts all its entries on an AtClose basis. Latency is under half of 1 second (close of bar to execution), slippage is (literally) zero. So I would still very much like to put this in a suggestion box.

Here is one (extreme but real) example of autotrade slippage:
5 March : close of 13:12 3min bar buy SKF at 231.93 (execution 232.81)
sell few bars later at bar-close of 235.24 (execution 234.74)
Now, over a large number of trades net slippage works out to a more acceptable number but, running at a rate of 5500 trades a year, it is not particularly part of the plan to play execution roulette.

All help/advise/insight appreciated






profile picture

Cone

#6
QUOTE:
would you know of any other WL autotraders
I don't, and I don't see anything in the v4 Code Library either. Sounds like it could be a useful addition to Community.Components though.


QUOTE:
The 10-30 second delay... How can I dig deeper and troubleshoot this ?
If you were using the Strategy Monitor, we could probably explain up to a 10 second delay for a group of 5 symbols getting an order to market. But look, in a streaming window with Auto-Trading it's hardly conceivable that there's more than 1 second delay placing the order after the close of interval... unless you're running a strategy that takes much longer than that to execute (unlikely). Why not just watch an order enter and be Placed, go Active, and Fill in the Orders tool? Watch a clock's second hand, or use a lap time on your mobile phone to count the delay between each phase.


QUOTE:
Good in theory, not so good in practise. Virtually no WL/Fidelity trades execute at the "1 tick" difference.
I'm talking about what it takes for an interrupt to occur that executes a Strategy. Of course there are delays from the theoretical, but sometimes they'll work in your favor too - slippage goes both ways!

Whatever you do, be sure to count slippage in percentage for stocks. There's a huge difference between the absolute price slippage you'll get on a GOOG or SKF than there is with a C or GE, so the percentage slippage is more meaningful when finding the average slippage.