Monday, September 20, 2010

Average True Range - GV

Average True Range (ATR) is based on volatility like Bollinger Bands (BB), which finds the simple mean and adds and subtracts the standard deviation from the mean for a band.

Chaikin's Volatility and Vertical Horizontal Filter (VHF) have curves similar to ATR for a given range. While the former two cannot be straightaway used as stoploss bands, both BB and ATR can be, as they are real-time range measurements as against indicators of volatility.

A few of us may be acquainted with the details of ATR, but for those who are not, here it is: ATR is the mean/simple average of the maximum of the following range alternatives, for a period of time:

(i) range between the high and lows of the day;
(ii) range between yesterday's close and today's high (mostly in a rising mkt) or yesterday's close and today's low (mostly in a falling market).

To convert this in to a band, one needs to add or subtract it with a choice of either the close or the extremes. One would choose the close if he wants to play safe and is concerned that he might lose out from the gains; or one would choose from extremes if he wants to make sure that the stoploss does not him out of a trend.

Again one can play with the 'averaging number' - 14 bars or 20 bars - as well as the multiplication factor for the range - whether 1 ATR or 2 ATR (just like the number of standard deviations chosen in BB).

Effectively this throws up three variables for designing. No set of variables work for all markets or stocks. They could work for one range of historical-volatility (HV) patterns exhibited by the market, or stocks, during the testing period. Even if HV changes for the same underlying, performance deviates significantly from the anticipated. This could be a huge amount, since the stoploss could put you out of the trend, with no re-entry in sight. Hence it is likely that on some occasions you would have lost a sizeable part of the trend while taking in all expected whipsaws.

Now comes the worst. I am not well acquainted with foreign markets, for example the US where most designers come from. It is thus logical that they have tested primarily their own markets. Specifically, the US market does not throw up gaps like Indian market does. So, if the US market is as advanced as claimed, then they should be less manipulated than ours, and therefore a smoother market, in terms of absence of gaps.

The big problem with gaps for trading systems is that they simply massacre your volatility-based stoplosses. Imagine a gap of 100 points. The range the expands to 100 for a specific bar and hence the simple average of this range, goes up roughly by a factor of 5 (if you took the standard 20-bar as the range).


Now multiply it with the factor of 2 or 2.5, it becomes very large. If you are subtracting it from the extremes (hoping to avoid losing a trend, which you could if you subtract from close or mean, then the range - and hence the stoploss - really expands indeed. Due to simple averaging used, the adverse effect stays for 19 more bars during which the trend could change and you would have lost out on a good part of the gain. This was common in 2008.

Alternatively, after a gap, the price action could remain narrow for over an hour or two, which is not uncommon and towards the end of which your stoploss would have come to very close to the price action. Then the price action may enlarge into a (even) a slightly a larger trading range triggering your stoploss.

The problem is because of the narrow range after a steep gap-up/gap-down and simple averaging, the discussed enlargement of the trading range would not be large enough to cause a moving average convergence (Maco), but would have put you out of market - that is no Maco if you had adopted larger parameters for your MAs (and smaller parameters will by themselves whipsaw any number of times and throw up so many trades that you would have become the loverboy of your broker and the villain of your dealer).

Saturday, August 28, 2010

The Drawdown - Prashanth K

Drawdown is a statistical function that is missed by many and worse mis-interpreted by many others. Every system builder always has one eye on the CAGR and another on drawdown. It is a balance that is often unstated but has to remain rational for any system that has been developed after much effort to become operational.

A 1000 percent return with a 90-percent drawdown is a lot worse than a 100 percent return with 9 percent drawdown, although mathematically both are similar. The reason I say that the second is more important is because there is something we call: "Your worst Drawdown is yet to come", which in efffect means that no matter what percentage your system backtest would show, the chance is greater that a drawdown greater than this would arise in real trading.

Secondly, the system does not consider the psychological profile of the trader. It is tough to live with a trade where you have lost nearly 10 percent of the capital as against living in a trade where you have lost nearly all of the equity.

So, lets look at what a drawdown is and why, in my opinion, it is one of the most important figures to see in any backtest.

An Amibroker Backtest report provides two drawdown figures. They are (copy-pasted from AB Help),

Max. trade drawdown - The largest peak-to-valley decline experienced in any single trade.

As explained, it is the drawdown an open trade experiences. For example, assume your system has gone long in ABC at Rs 100 and the stock, after moving to 102, has moved to 96 without there being any additional signal.

The Trade drawdown in this case will be 6 * Qty (102 - 96 = 6).

Max trade % drawdown - The largest peak to valley percentage decline experienced in any single trade .

The above example expressed in percentage terms.

Max system drawdown - The largest peak to valley decline experienced in portfolio equity

This statisic is bit different, in the sense instead of taking a single ticker, it takes the equity as the ticker and provides the drawdown static.

Max system % drawdown - The largest peak to valley percentage decline experienced in portfolio equity.

Same as above expressed in percentage terms.

System Drawdown is useful to know since sometimes systems go into multuiple losses and the equity line plunges dramatically. For example, a system equity after reaching say 10,000 starts having loss trades (consecutively) and reaches 8000, this change would be shown here.

The system drawdown is a important factor to consider when deciding the capital requirement for the system, since if you are using leverage, a large system drawdown can ensure that you no longer can trade with the amount you have in hand and hence all permutations and calculations can go awry.

Benchmarking and Leverage - Prashanth K

A friend of mine was recently suggesting to a group, where I was part of, that the easiest way to pick stocks was to get MetaStock, run its indicators and select a list of stocks based on discretion.

I generally argue against such BS, but did not have the mood to do so and let it pass. But the information he sought to convey is that all you needed is MS and a data provider and well, you could well be on the way to riches and glory.

Just yesterday I was discussing with a friend (who is also a client of mine) about the importance of 'Benchmarking'. I believe if a system is not able to generate at the minimum twice the return of a said benchmark (after deducting all expenses incurred in regard to trading that system), it may be wiser to be a Buy and Hold (or shall I say Buy and Hope) investor - since one can spend the same time doing some other profitable work.

Generally when computing returns, people forget the risk they take (leverage) and instead calculate directly the net profit or loss. A friend of mine recently showed me a list showing the returns generated by him for his clients. He has over nine months averaged around 5 percent per month, net of brokerage and taxes.

While on the face of it, it's a commendable performance, what one misses is the fact that he uses nearly 5 times leverage to achieve such returns. The question that one should then ask is whether the risk is worth the reward. Five times the capital is no small leverage and one bad move can wipe out returns generated over months together. Hence once should carefully evaluate risk rewards before entering any kind of trade.

The author is a member of Bangalore Stock Exchange.

Friday, July 25, 2008

Seventy Thousand to 55 Lakh - The Chaoist

It was August 2007 and I had been trading for 2 years by then, working hard, learning everything I found on the markets, but I had still had no rewards. In fact, I had just Rs 70,000 left in my trading account. I could do all kinds of technical analysis, build trading systems, etc., but it was not leading me to profits and success in trading.

I had sacrificed my college education, so that I could be successful trading, but here I was, down to my last few thousands. I decided that if I lost this Rs 70,000, I would try and make a living selling trading systems and by giving tips to other traders.

However, come August 2007, everything changed. I suddenly started to make money. The Rs 70,000 I was down to, now started growing exponentially, until it reached what is now Rs 55 lakh - yes Rs 55 lakh!

So, what had changed suddenly?

I have no precise answer. I even wondered how a 21-year old like me, without college education, and who was perhaps in the middle of the trading curve, was able to make so much money, while there were so many more people with much more knowledge, still struggling in the market? My young mind was suddenly filled with many questions?

Was trading a game of technicals? What separates a winning trader from a losing trader? Was my journey from Rs 70,000 to Rs 55 lakh merely a product of luck? There are many questions to which I need to find the answers, but I decided to share the few reasons that I think lead to my success in trading in last one year:

1. I cannot deny the fact that I was lucky. Life is unfair - this is a fact. When I had Rs 70,000 at the beginning of August 2007, a few losing trades could have wiped out all my money. So at that time I was lucky enough to survive despite being undercapitalized. However, I think later on, after these 1-2 months it was not just pure luck that brought me to Rs 55 lakh.

2. I am believer of the Van Tharpe trading model trading, which says: Trading is 10 percent technicals, 40 percent psychology and 50 percent risk management. I concentrated on the last two things and it paid off. To manage risk, I was trading only intraday, and I never traded overnight positions. This may sound contradictory to the many sermons one receives on how it is so terrible to being an intraday trader.

3. My sole policy was to survive first and then make money. If you are surviving in markets and losing small, you will have time when you are favored by luck and you will make it big.

4. A trader without risk management is like a nude girl in a boy's hostel. If you are using leverage, you should either be hedging your positions or you should not carry overnight positions. Otherwise it is just a matter of time when a big gapup or gapdown will wipe you out.

5. The old classical things we need to fight are fear, greed, hope and bias. Bias is ignored by many but it can cause serious problems.

6. Becoming successful trader is a process. It is like any sport, which you learn the basic rules but then develop your own style. Let us say cricket - each batsman (or bowler) has his own style, which is unique to him. You cannot fully copy anyone, but you can learn from others and develop your own technique of playing in markets, based on your strengths.

7. There are unlimited number of ways you can make money in the markets and unlimited number of ways you can lose.

8. Supports and resistances are for making bulls and bears hope. If you use technicals and want to become a sound technical trader, then I would advise to go for automatic system trading. For others always remember not to use supports and resistances for hoping in the markets.

9. Trading is very simple but it is not easy.

10. Keep your losses small and let your profits run. You have read that in many places but this holds true, so implement it practically.

11. Remember the worst mistakes are made at the best times and best of the trades are made at the worst times.

11. Feel free to short sell. Short selling is a great way to make fast money.

12. Always be prepared for the worst, and and when you are feeling stuck, remember these lines: "The further you run from your sins, the more exhausted you are when they catch up to you. And they do".

13. There are no shortcuts. You have to go through learning the process of trading.

14. If you did well paper trading, it is not necessary you will do well in real-time trading. It has the same difference as in batting at Net practice and batting under pressure on the field.