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).

Sunday, September 5, 2010

What Should be Your Favorite Mutual Fund

An investment in a Nifty Junior ETF would have returned far better than an investment in all the mid-cap mutual funds in the country. Nothing more to be said.

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.