Archive

Archive for September, 2007

Sucker punch! (an example)

September 26th, 2007

To illustrate what I was talking about last time, I introduce a simple example: the morning breakout strategy. Variations on this strategy have been discussed in a variety of sources from Perry Kaufman’s encyclopedic tome to a recent copy of Futures Magazine.

The rationale behind this strategy is based on the premise that the first n minutes of a trading session will frequently see the entire movement for the session and that thus breakouts from this range will prove to be decisive for the day. One can take this basic idea and create a bewildering array of strategies by adding pre-trade filters and all sorts of exits.

They all have the same basic feature: they’re losers.

Sucker punch!

We’ll stay simple and assume that our strategy will set stops at the observed max & min of the session after n minutes of the session have passed. At the end of the day, we’ll exit any position the strategy has
initiated. And for maximal simplicity (and perhaps some psychological sense of “safety”) we’ll allow the stops to stay in the market all day so they act as stop-losses for each other when positions are entered.

Thus our strategy has two optimizable parameters: what to trade and when to set the stops. The first is of type contract and the second is an integer. Finally, we have some fixed parameters (i.e., it doesn’t make sense to try to optimize them) denoting when the session starts and how much money to risk or how many shares or contracts to trade.

If we do a parameter optimization on this strategy using, say, the s&p 500 components as values for the first parameter and setting the n breakout range to values { 20, 40, 60, 80 } we end up with 500 X 4 distinct strategies which each get back-tested to produce our results.

In the next post, we’ll review the results and consider how to reason about them.

back-testing, books, performance analysis, strategy development

Fool’s gold

September 26th, 2007

One of the biggest issues facing algorithmic traders is recognizing and avoiding the data-mining / back-testing phenomenon of fool’s gold.

The problem is that the evidently improbable becomes incredibly less so when many instances are considered. One of the inevitable first reactions a would-be algorithmic trader has when first putting together a strategy and running it through a parameter-based optimizer is:

“I’m going to be rich!”

Fool's gold

“How could it be otherwise? There’s no way such an improbable result could indicate anything but that my strategy is predictive – I have placed my finger on one of those oft-mentioned market inefficiencies and thereby created a little money machine!”

Happily, ours is an experimental practice, so it’s quite easy to test our hypothesis and (assuming you have a reasonable environment in which your back-tested strategy can be placed – unchanged – onto some real financial exchange) place our money where our mouth is…

And this is where it gets tricky – because you might even make some money! Maybe a lot. But unless you’re really really lucky, at some point your fortunes will turn and that strategy which over the past n months has been a demonstrable goldmine will suddenly start misbehaving. Your elation will turn to confusion and then chagrin and then – for the obstinate – pain and horror.

What is going on here? How did we happy miners find ourselves grasping bitter buckets filled with fool’s gold? This will be the subject of our initial series of posts…

back-testing, performance analysis, strategy development