TradingSystems

Strangle Strategy – 50% gain on a low frequency system

1 Comment » Written on September 15th, 2008 by
Categories: Options, Strangle, TradingSystems
I wrote about a Straddle/Strangle strategy in the early part of the month, saying that if the spread narrowed I would pick it up, because we were ripe for a large move.

So last thursday, with the Nifty around 4300, I bought a 4200 put and a 4400 call, for about Rs. 80 each. The idea was that a big move had to happen either in September or October, because three expiries - June, July and August - were at 4200-4300. I paid Rs. 160 per nifty - a per contract cost of Rs. 8000.

Today the 4200 put quoted at 225 and the 4400 call at 20, giving me a net return of Rs. 245 - a 50% return in a few days. Now I wouldn't bet my entire capital on such a system - given that it sets up once in a while and can take two months to return money. But even then, an appropriate strategy for such situations (and other strategies for others ) can provide a 40-50% return in a very short period. Most of the other time you can put the cash into a liquid fund to get your average 7-8%.

We've got a few such setups - that don't occur very often, but when they do, they seem to provide a very very good return. Our aim is to build a big database of them, so we will get at least one setup a month - and that, as a combined system, will give us good returns. It's not difficult to automate - but the challenge is in analysing and following up such systems with real money.

If you're a reader that got excited with the "50%" figure, note that this is not something you should just do for the heck of it. The setup came, and it went. It may not come again for the next two years. So don't do something like this unless you have tested it thoroughly and are comfortable even losing money on a system like it.

Don’t Override Your System; stay FAT

No Comments » Written on September 2nd, 2008 by
Categories: Options, TradingSystems
So today was a crazy day. We were long four stocks and short one - Cairn - as our system threw out the trades. Within a few minutes we noticed that there was a strong move up - and after a 2% upmove in an hour, in which Cairn tanked about 3%, we decided to take a "discretionary" call - to exit. After all, the market was up 2.5% - how much more could it go?

As it turns out, a lot more. It ended up 3.57% up.

But that was not the worst of it. If we had not used discretion, we'd have been up 5%. Lesson learnt: don't override the system.

We generally never do - in fact if either of us think of it, the other person stops him. And earlier there are instances when our discretion has proved to be beneficial. But net-net it seems to do nothing - and the discretion adds emotional baggage we don't particularly want. The best, therefore, is for computers to take over and do the trading - no discretion, no emotion, just a P&L at the end of the day.

Fully Automated Trading - the only reason I want to stay FAT.

On another front, my Nifty straddle went nuts. From a net price of Rs. 126 yesterday it was up to Rs. 170 today - a Rs. 44 profit, which is 30% plus. Of course I can't claim it's a single day, and since I wouldn't put all my capital on it it wouldn't even be 30% of total capital. But say I were to allocate some 1/5th of capital it would return about 6%. That's not bad at all, even if this were the only deal to happen the whole month.

Having said that, I went long another strangle near the money - the idea being that such moves will result in either an extension of the move, or a retracement, again helping a long strangle. If I were to suggest a new position - as of end of day today - it would be a 4700 call and a 4300 put - for a net cost of Rs. 120. A profit target of 20% would apply - and then yet another strangle. My preliminary back tests show that this is only successful when the index has been range bound for a while - but when it does set up, it's largely successful.

Note: to program this into a trading system is trivial, so it's not quite discretionary. But I haven't quite done the full array of tests I would usually do with a system, so I consider it a discretionary trade.

System Trading – Time for a Nifty straddle?

4 comments Written on September 2nd, 2008 by
Categories: TradingSystems
A small system update: We've been testing and working with about 3 systems with real money and a couple others under a test phase. We've thrown out two - one gave us a bad drawdown but we've modified and are paper trading that, and the other is not implementable because of lack of proper infrastructure.

The third- and our flagship - is now at around 16% real money return over three months. We tried some stunts - leveraging it, adding/deleting capital etc. - just to see how it performs. But now we're back with a non leveraged system - and 16% is the auditable profit.

Interesting some other systems come into play once in a while - not every day, or every week - but just once in a while. Kinda like Kaushik's Gold/Nifty pair trade (29% in three weeks there).

One such thing I'm thinking of is a Nifty option straddle or strangle. The Nifty was at 4300 on June expiry, and at about the same level in the July expiry. In August it closed at 4210.

This is a fairly tight range, and I looked back a little bit to see how such a scenario has panned out. Nifty has had futures only since 2000, but real trading probably started in 2002. SO let's check a 1 month (expiry to expiry) move and a 2 month move since 2002:

  • Every time both one month and two month moves have been less than 4%, there has been a 10% move (expiry to expiry) in the subsequent two months (either one month or two month).
  • Except once, in Sep/Oct 2002 where such a situation lasted two months (i.e. one and two month moves were less than 4%) and the third month there was a 10% move. Even then I'm not sure I should bother because the nifty future turnover on expiry day was 100 cr. We do that
  • There may be large fluctuations within the month but I'm not counting those.
  • Our current one and two month moves - as of end August - are 2% each.
Would it be conducive to buy a straddle (buy a put and call at the expiry strike)? Or a strangle - an out of the money put and an out of the money call?

I can't really back test - because I have only a few data points and options only got really liquid only after 2005 or so. But it seems like there is a profitable opportunity if one were to buy a straddle for around 5% when such situations occurred.

Current straddle rates are around 8% (300 points on a Nifty of 4200). Not entirely profitable, to be honest - but if the Nifty stays in this range till mid-month, things might be better. Need to do a comprehensive back test, but it's fodder to start.

Now other situations exist. There could be the situation that an intermediate move will take you into a profit zone. Also need to test strangles. Finally of course, implied volatility plays a part - so perhaps the idea is to buy low IV strangles, as compared to the rest of the option chain.

This is more of a low frequency, high probability (LFHP) trade. It won't set up every day or every month, but when it does set up it has a high chance of success. Now if we were to get 50 such LFHPs, maybe we can get a more stable return. (Of course, with Murphy's law, all will set up at the same time, and you will not be able to allocate capital). Still, if the returns are reasonable on a per-setup basis, this might be a way to get alpha in the longer term.

Disclosure: Long a Nifty strangle [Couldn't resist]

Dark Pools and Algorithmic Trading

1 Comment » Written on July 14th, 2008 by
Categories: Commentary, TradingSystems
From Economic Times: Dark pools threaten the existence of LSE, NYSE and Euronext:
Dark pools, to put it simply, are essentially trading platforms and exchanges that match block institutional orders, bypassing the main exchanges completely in off-market deals, and don't publish stock quotes. The geeky jargon in the circuit is primarily because it's been made possible by increasingly sophisticated technology like algorithmic trading tools. Algorithmic trading, says one study, will account for more than 50 % of all shares that change hands in the US by 2010.

Why dark pools? Since most bids and offers on say, LSE, NYSE or Nasdaq are shown publicly, trading on these exchanges is like, as one report says, "playing poker with an open hand."

Dark pools, by contrast, guarantee absolute anonymity and secrecy to buy-side traders worried about revealing their strategies, accesses available liquidity outside the exchanges, and is only reported to the light side post-trade. It is, of course, all intensely regulated and painstakingly legal – dark pools have taken off in Europe only after the introduction of MiFID, which discourages internalisation of trades, and Regulation NMS in the US.

India has anonymous exchange systems anyhow at the retail end, and members of the exchange are disallowed from squaring off trades themselves - i.e. matching orders without sending them to the exchanges. With DMA, even institutional orders may become anonymous. Of course the knowledge of the order flow may exist with the broker (who needs to account for margining etc.) but that's only postdictive i.e. only after the order is sent to the exchanges.

Indian tax laws discourage off market trades too - you pay more tax on non-exchange-traded transactions so you are likely to trade on the exchange as much as possible.

The need for a dark pool isn't apparent here yet, given that the order matching systems even allow masking of trade volumes (you can see a different quantity than is actually asked for). Also, algorithmic trading isn't very popular (thank goodness for that, it's our future business model).

But there is need for it in the stock lending system for short selling. That bit currently reveals too much - needs to get pared down.

I have no doubt that should SEBI be lax about it, dark pools will start in India eventually. It already exists in most OTC derivatives like forex, where banks have trading desks that match order flow. When the stock markets get heavily liquid and full of algo traders, there will be a need to hide information. The future is bright. Or dark, whichever way you see it.

Arguments against Automated Trading

14 comments Written on July 5th, 2008 by
Categories: TradingSystems
I've been speaking with a few people lately and also looking at the comments on trading systems. A number of people feel that this concept of an "automated trading system" is very strange and it simply won't work.

Most people quote that they have seen a thousand of them earlier and they didn't work. While I understand systems tend to fail (especially after they are public for a while), I am willing to bet that most systems "appear" to fail because of the lack of discipline. Most people fear for their life after a few bad trades and have no real way to prove that a system has indeed stopped working; so they throw out the system.

If there's a series of losses the position sizing techniques (always only risk a percentage of equity, post losses) should keep the position down - but a discretionary impact may be to stop real money and paper trade the next few trades, until there is confirmation that the system has gone bust. Or, to put lesser money in. The concept of throwing out a system on a few trades is probably the most attractive to a human mind, yet, the logical thing is to await some quantitative proof that the system no longer works.

The other problem people have is they are incredulous. How can a system that is computerised and requires no human intervention, perform at any consistent rate? But that's precisely why it does, because it has no human emotion to contend with. The more humans get involved in trades, the more likely it is for mistakes to happen. Now there are many traders who are excellent at intuition, and the vast majority of trades happen on "gut feel" - so there is always the feeling of a loss of control when you let it all happen in an automated way. But you can't back-test "gut feel" and you can't establish how something might have worked in the past when it's based on intuition.

This goes for a lot of fundamental stuff too. People say that's better because it's a more logical way to invest. I doubt it. Fundamentals are scary in these times when companies will lie through their teeth to prevent their stock from falling, or scream buyback, or ask for SEBI to investigate - anything to protect their stock price. You can't trust anything anyone says - at least one thing you can trust is the stock price! And the concept of buy and hold will soon be apparently flawed, as people who bought RNRL at 212 and DLF at 1200 realise how interesting life becomes when you buy and hold for a long time.

Still, value works - and can be backtested - if there is a measure for value. You can check things like how far below we are from a long term moving average, how much cash a stock has in comparison to price, how much of past earnings growth over say 5 years is reflected in the P/E. These concepts can be back tested, and even automatically traded (imagine, automated fundamental trading!) The concept there may yield far too few trades - maybe a few a year - but may be far more attractive in the long term (10+ years)

Lastly people are cynical about such systems. They think it's a fad, it will go away. Yes, sorta like fundamental investing "went away". Or stock markets "go away". There are examples of HUGE profits from such systems - look at DE Shaw, Jim Simons of Rennaissance Technologies, Ken Griffin of Citadel or Man Investments. These guys manage billions and billions of dollars, through automated systems, and make a ton of money - some put their annual income (performance fees + management fees) as upwards of $1.5 billion. That's enough to silence most critics - because you only need one such case to DISPROVE the argument that systems don't work.

I'm not saying other forms of investing don't work. Warren Buffett's has, obviously, and so have those of Peter Lynch or Rakesh Jhunjhunwala. Or even the discretionary trading of John Arnold or Steve Cohen. But that doesn't mean pure automated systems don't work - they do, as the performance of the big hedge funds mentioned above are well known.

My aim, and Kaushik's, is to become that kind of automated trading firm for the Indian markets. Obviously we lack the money (otherwise life would be different) to invest in the technology and the connectivity/membership required to make this happen. Also the track record necessary to attract the right kind of money. Keeps us excited!

Trading Systems: Getting Beaten Up By Volatility

8 comments Written on July 3rd, 2008 by
Categories: TradingSystems
Man what a wild two days. Up 5% on one and then down 4% the very next day. Volatile times! Yes, yes, I'd predicted a rally on Wednesday and it turned out right but don't read too much into that, it was pure luck.

Okay, so why are we still so badly mauled? This is a time to be careful and please, respect those stop losses. I'm expecting another bounce soon, we're back to oversold territory.

Unfortunately this volatility ripped apart our systems. The two intraday systems made money on all the last three days - Tuesday going down 4%, Wednesday up 5% and Thu down 4%. On one system we are up nearly 10% in July (3 trading days) and the other, we're up 15%. Pretty good.

Our longer term systems got hosed pretty badly (in our view). One system is up only 1.5% in the last three days, and the other is down nearly 9% (which is lousy even if the system isn't designed to take this kind of volatility). Net of all four systems, we are at +0.33% for the month (each system has a different amount of money on it). With the index falling about 3% in the same time, we have done better, but this is not satisfactory - we should have gotten better results.

(Note: I'm not comparing earlier times. FTR, June has been kind to us: 9.9% returns versus a Nifty drop of -17%, and half of May - our first system went online on May 15 - was at 1.46% versus Nifty drop of -2.81%)

Am I going to reveal what's in the system? No. We need to run our money on it and this is our sole source of income - there is no way I will jeopardize that right now. And, we will eventually move into a money management role and then OTHER people's wealth will run on these (or variations of these) - and I don't want to let that opportunity go either.

But one thing is for sure: This is a SIMPLE system which takes only ONE factor into consideration: Stock Price. We trade only liquid stocks, and the systems look ONLY at price. If anything else is used it is volume (in determining which stock to trade). Sometimes the simpler the system, the better.

I will see if I can post a small graph of our systems (since we had real money behind it) versus the Nifty. I know this is just me showing off, but what the heck, I feel proud of it.

I think this field will soon need smart programmers. If you're interested in this field and have some ideas, touch base with me (deepakshenoy at gmail). What will be needed is people with a mind to automate, and the ability to code - not the trader who wants to put discretion into every trade. Meaning: if you think you have to be there to know the current news, the data, what people are saying etc. before buying or selling, we aren't going to gel. Eventually we want to create a hedge fund where all trading is done by computers and only a few people will exist - and make a lot of money.

System Trading – A link to begin with

4 comments Written on June 11th, 2008 by
Categories: TradingSystems
To read more about System Trading (read my last post) check out Ed Seykota's Trading System Project.

The project gives you an idea about how trading systems can be created and what is important. While this uses U.S. data it can be applied to Indian data as well.

Creating Automated Trading Systems

26 comments Written on May 26th, 2008 by
Categories: Commentary, TradingSystems
As a geek and a trader, I've always been fascinated by the thought of "automated trading". The idea is to have algorithms recognise patterns in stock market data, and automatically take on positions when something is favourable. But this is not just random pattern recognition - the whole area of technical analysis is a science that goes back 200 years (or some crazy number, basically it existed before I was born. And before you were born)

So the idea is that you first create a hypothesis. The hypothesis can be something simple ("Stocks go up in April") to something complex ("A positive slope ADX with DI+ greater than DI-, combined with a reversing slower acceleration parabolic SAR switchover has a positive expectancy"). If you think the second one is a joke, think again - a number of traders use it.

The hypothesis can then be tested using historical data, automatically, by a computer program. The concept is simple - start with some equity at some past date. With the data on that date, would you take the position? If so, allocate the equity appropriately, reducing brokerage and other transaction costs. Also deal with "slippage" - a difference between noted price and what you will actually get (effect of a moving market).

Then go to the next available date, and consider your options again. Would you get out of your current position? (a "stop-loss" or "book-profit") Would you reverse and short? (for systems that go both ways) Would you take on a fresh position?

All these are trading rules.

Consider also: Position sizing. How much do you allocate per trade? At what point does it make sense to get out on a portfolio level? Say you allocate maximum 2% risk per position - meaning for a 10 lakh portfolio the stop loss per position is Rs. 20,000 regardless of other considerations.

Some of these rules come together as "money management" rules.

The results of a historical back-test will show:

  • Is the system profitable? Obviously you should be net positive over a reasonably long period. But in the interim smaller periods can be net negative - a system that is profitable over a year, could lose money on a monthly basis but have one big month that makes it work. (Such systems should be handled with care)
  • What's the maximum drawdown? A system will have a drawdown - the highest peak-to-trough difference. This is an indication of the highest percentage you could have lost had you entered at a different point.
  • Number of trades, no. of wins and losses, and average win and loss. Important figures to find out probabilities.
  • Expectancy: This is mathematically (No. of wins)x(average win) - (No. of losses)x(average loss(). If this figure is negative, the system isn't quite working for you. But this figure is only relevant for a very large number of trades - don't bother about this below 40-50 trades.
Once we have a back tested system, we have to analyse what works well and what does not. A system with phenomenal profitability - like 500% or something - is unrealistic , so you should be skeptical. Lots of things can make good results, but be a bad system in reality. Firstly, bad data - not all data available is representative of a real world - for example a few weeks ago, NSE reports that Reliance opened at Rs. 3,000 and that was the high of the day. The problem is it could be one trade of 1 share at this price, but if that makes your system look good, you are going to be in trouble when you really implement it. So discard such odd data points.

Second, you can overfit the system to past data. Let's say the system was "Stocks go up in April". That didn't work. SO you said, ok let's do "Stocks go up in May". That doesn't work either. So you add more rules like "April of every year which is an even number, but ignoring April 15, 16 and 17, unless one of them is a weekend, in which case you don't take April 10, 11 and 12". This may give you a phenomenal result tested in the past 10 years, but you have an overfit system - it is very unlikely to work in the future.

Once you have a system you like - I will talk about how to choose a system in a different post - you can then "paper trade" it. Meaning, run it and take the next few signals on some "virtual" money, and see if it works over a good period (of say 40-50 trades).

And if both the back test and paper-trade yield good results, you can start putting real money behind the calls. Remember you should continue to backtest as you move forward to see if the market scenario changes results dramatically.

If we were able to identify, back-test and paper trade systems, then can we set up a computer to trade some money automatically? This saves us time and effort to have to keep watching tickers - and instead, focus on building better systems. In theory this is possible but most brokers in India are loath to provide API access to their systems. There could be regulatory hassles to this too.

But my geekiness has prevailed and I think it's possible to do - create a system, paper trade it and convert it to auto-trade. I have built two such systems, but what I will do is to take a simple system in another post and demonstrate how a system can be built, tested and paper-traded.

This is an exciting field - very old in the U.S. but extremely worthwhile in India to investigate. Even if one avoids technicals, a system based on "news" and "fundamentals" can be build - the code required for it is not dramatically different.

This, both Kaushik and I think, is the future of the stock markets in India. In the U.S. nearly 30% of volumes come from automated systems. It's time this happens in India - not just will volumes increase, but more discipline will be maintained as computers can be made to follow rules strictly.

Let's look at this some more in subsequent posts, but tell me - what do you think?