Saturday, August 20, 2005

Late Summer Trading System Development

Late Summer seems to be the time of year when I become interested in developing technical trading systems. Last Summer I spent a lot of time working on technical trading systems in C#. I had one that used bollinger-bands to play counter-trend moves that showed some promise....but a lot more work needs to be done on that one. This is a task I haven't been interested in committing myself too so far, but it's on the ol' "to-do list".

A few weeks ago I was reading this thread on Elite Trader, about High Frequency Trading. There has been a lot of buzz recently about High Frequency Trading, because some famous hedge-fund manager with an incredible track-record recently announced a new fund that uses HFT strategies and he's accepting huge amounts of money. The buzz has got me thinking about HFT ideas. As far as I can tell, HFT is mostly intermarket arbitrage, statistical arbitrage, and liquidity providing strategies all done very rapidly on an intraday basis. They have an edge from processing information (including order book analysis) very rapidly using computers, and because they have a superior speed of execution.

I don't have access to intraday tick historical data, but I was thinking that maybe a liquidity providing strategy might work on a longer time-span, especially if the strategy buys and sells against the market direction when it is making slightly above average movements. My thought was that during such times the market might be slightly out of balance, and the strategy might be able to make a profit by taking the other side of the market herd's trade. The goal of the strategy was to be buying and selling at the fringes of the current volatility.

The system consists of two independant agents. A bullish contrarian and a bearish contrarian. They each make a decision on whether or not to buy or sell stock, and the program consolidates their trades into a net decision on how much stock to buy or sell. The agent's entry points are scaled by recent historical volatility (I was generally using 30 days). The system is intiated on the first day with both agents intiating a position. The bear agent shorts a unit of stock, and the bull agent buys a unit of stock. Both of their trades cancel each other out so no actual net-trade is made. This gives both agents a point of reference on which to make subsequent trades. Any time the stock price moves one daily standard-deviation in either direction away from the last trade on the agent's virtual book that agent initiates a new trade. Furthermore if the stock price has moved more than one daily standard-deviation that results in a profit for any trades in the agent's virtual book, the agent closes those trades for a profit. The 2 agent's trades are then consolidated and used to make a net trade on the real account. Every time the stock moves more than one daily standard deviation both agents make new positions, but one agent will be cancelling out his new position initiation with a profit taking on a previously opened trade so his book does not actually change.

The major problem for the system is trending markets. Eventually one agent will accumulate positions it will never be able to get out of because the stock will never reach those levels again. I tried several variations to deal with this. One system bought options and basically allowed the unprofitable options to expire while rolling the profitable ones forward. Another versions used various price-stop losses and time-based stop losses. Most of my time was spent writing code to handle the accounting. Since the system always has a position on the books which it is adding to or depleting from, it was hard to figure out a good way to pair the trades so that I could compute useful statistics for evaluating the system such as the winning trades percentage, losing trade percentage, expectancy, etc...It was easy to compute total PnL and do drawdown analysis though.

At times the system seemed like it was going to be wildly successful and I was quite excited. Always this turned out to be due to a bug or a data flaw which when fixed also erased the phantom profits. I was back-testing it on a just a few stocks. My final conclusion was that the system wasn't that great so I didn't bother to do a wide-scale backtest on hundreds of stocks, yet.

It looks like it might have some promise if one could somehow identify times when a stock isn't actively trending. I also am kicking around ideas for how to make the system adjust the strategy during trending markets as positions accumulate. In general the stop losses schemes didn't help the system much. They did mitigate losses during times when the system was taking large losses, but they also reduced the profits too much. Also, I realize that I need to change the entry/exit decisions to use the standard deviation for the time period elapsed since the last trade instead of the daily standard-deviation. I think this would cause the system to be puting on trades after the market has made more extreme moves which are typically good times to be accumulating positions for counter-trend systems like this. As it is now, the system is puting on trades often when nothing significant is really happening in the market. Someday maybe I'll test this strategy with intra-day data. With intra-day data the system would be implemented with limit orders at the price trigger points, and would profit from the bid/ask spread which would probably help the system out quite a bit.

It was an interesting idea. I am fascinated by the idea of simple agents interacting together to produce complicated behavior. This type of phenomena is called cellular-automata. I've successfully used cellular-automata ideas to solve some tricky image-processing problems in the past in my main business (computer graphics). I'm definately intrigued by the idea of using cellular-automata for trading. This may even inspire me to actually finish reading A New Kind Of Science which is supposedly a good book about cellular automata. Like most owners of this book, I haven't read past the first few chapters because it's the size of a phonebook and incredibly dull, but maybe it could spawn some new trading system ideas. I've read a lot of books in the past year about derivitive pricing, so my tolerance for boring books may be much higher than when I first attempted to read A New Kind of Science years ago.

Friday, August 12, 2005

CSCO continued...

I had major computer problems the past few days so I wasn't able to follow up on the CSCO idea that much. I did check the underlying price the day after earnings and it looks like my idea that CSCO earnings wouldn't be a big deal, was wrong. The stock broke below the break-even points for every one of those trade ideas so most likely they were losses.

Tuesday, August 09, 2005

CSCO

My suspician is that CSCO's earnings after the bell today won't move the stock much. I was trying to think of an option position to enter in advance of earnings today that might profit. I decided that I'm too inexperienced with this type of trade to make a good judgement on what type to make, so I decided to write some ideas down instead and then check to see what happens tomorrow.

The obvious strategy I guess would be to short a straddle. The front-month 20.0 straddle is 1.10 bid x 1.20 offered. This would have a maximum profit of 1.20, with break-evens at 21.10, and 18.90. The idea selling a straddle ahead of earnings makes me nervous. I think the earnings won't be a big deal, but hey I'm very likely wrong....I'd hate to pay a serious penalty if I was wrong....

The next idea I thought of was to buy a butterfly. The 17.50-20.00-22.50 call butterfly is 1.35 bid x 1.60 offered. If I am calculating correctly, that would be a potential max profit of 3.45, with break evens at 19.10 and 20.90.

I was also thinking about time-spreads. Time-spreads are always confusing to me. Sell the aug 20.00 call at .35 and buy the sept at .60? The front month has a volatility of 40.2% or so while the sept has a volatility of 29.0%. This seems like it would be favorable since I'd be selling a high-volatility option and buying a low volatility option. The thing is IV is I think volatility will decrease after earnings. Time-spreads generally are hurt by implied volatility drops.