The Eggonomist

Entries from June 2009

Adaptivity

June 27, 2009 · Leave a Comment

My attempts at creating an intelligent, adaptive system for the past 2 days have been met by frustration and annoyance. The idea is great, but trying to 1) computerize it and 2) get it to work together with my existing systems is a whole different story. Gaaahh.

One of the main reasons for it not working as well as I’d hoped is the adaptive indicator (the indicator that tells me if the market is trending). The adaptive indicator is a short term one, whereas the majority of my trend-following systems are medium to long term (to avoid getting whipsawed). Having a long term adaptive indicator is counter-productive, since by the time it indicates that a trend is present, the trend is already heavily under way.

Also, another problem lies with the complexity: having an adaptive system invariably results in many conditions in programming it. For example, I have to indicate rules like “if a trend is present (based on my adaptive indicator), then implement System X and Stop A. If not, then implement System Y and Stop B.” The multitude of rules makes system testing extremely slow, such that optimizing to find a good set of parameters is no longer possible. (well, I guess it would be possible, but testing would probably run for 4 to 6 hours – time I cannot afford) There is also the possible danger of curve-fitting.

In fact, the exercise got so frustrating today that I had to lie down on the grass on College Green to try to clear my head and get some inspiration. I came up with a methodology for doing my research: determining which periods were trending and non-trending, develop trending and countertrend systems separately, ensuring that they maximize ratios during their respective periods, then attempt to combine them. The last stage was where things fell apart. I’m going to have to spend more time on this.

However, if this whole adaptive system thing doesn’t work out, something good came out of it: I managed to come up with an adaptive stop-loss, which seems pretty useful from my cursory observation of it. When the markets are trending, it allows the markets to move in the anticipated direction, giving it lots of room. However, once my indicator tells me that the market has entered a sideways phase, the stops move closer to the price and take me out of the position for a profit.

atr stop

As explained, the system enters long and the trailing stops are placed very far away from the actual price, but are always moving in my favor. However, once the trend is over, the stops take me right out.

A thought came into my head today as I was thinking about how frustrating this research was: Every failure I encounter now is just one more step towards preventing another costly trade in the future. I have to keep pressing on.

Categories: research

A Flash of Inspiration

June 25, 2009 · Leave a Comment

Sometimes, articulating my concepts in simple terms can give me some great ideas. I was trying to explain my research last night over the phone to the girlfriend  when I realized that I had unexpectedly come up with a focus of what I was looking for. I quickly typed out the following brainstorming points:

1) At any given time, markets move in 3 directions: upwards, downwards or sideways.

2) A successful system is one which is robust, meaning that it works across time and across markets.

3) That means that a successful system adapts to changing market conditions: If markets trend up or down, the system needs to employ a trend-following mechanism. If markets move sideways, the system needs to either trade minimally (or not at all), or to employ a band-trading/countertrend mechanism.

4) The key to making a system adaptive is to come up with an indicator to determine what condition the market is going through at the present moment. I have only read of some indicators assessing the “efficiency” of the market, though there might be more out there that fit this criteria.

5) If the indicator shows that the market is trending, then trend-following entry points need to kick in. These should should be combined with wide stops (to ensure that one does not get stopped out of a trend), as well as profit-taking exits that determine that the trend is over.

6) If the indicator shows that the market is moving sideways, then the system should either a) stay out of the market, or b) employ some band-trading/countertrend techniques with tight stops. Or perhaps a short-term market predictor might work as well.

7) Even though the system should work across different markets, it might be possible for the system to have different parameters across different markets. This is because different markets have different characteristics in transitioning from trending to non-trending phases.

Finally, a focus!

Categories: trading philosophy

It’s Nice to Know You’re Being Read

June 25, 2009 · Leave a Comment

Jodi Beggs (or “econgirl”), the author of Economists Do It With Models, commented in my About Me section!

I’m very flattered. :)

Categories: Economics
Tagged: ,

Countertrend Systems

June 23, 2009 · Leave a Comment

I’ve noticed that countertrend systems seem to perform very well in “normal” trending periods, but are very poor when it comes to fat-tailed events. I was looking at a modified version of the “Double-7s” system that I read about in Technical Analysis of Stocks and Commodities magazine. The system buys when the close is equal to the lowest close in 7 days and if the close is above the 200-day moving average. The system exits when the close is equal to the highest close in 7 days. The reverse holds for short selling. In other words, the system attempts to buy on retracements, counter to the existing trend.

Below is a screenshot of my system test on the Hang Seng Index:

HSI2

As you can see, system equity becomes more volatile and falls drastically from 2008 onwards, confirming that countertrend systems are one of the hardest systems to trade. In “normal” times though, it would provide the perfect compliment to a trending system, since it would offset the losses from a trending system. The trouble is figuring out when times are “normal!”

Categories: research
Tagged: ,

Stops and New Markets

June 23, 2009 · Leave a Comment

Update on the trading research so far:

I’ve managed to computerize the ATR trailing stop and the volatility breakout stop. At first glance, when combined with an arbitrary channel breakout system on the Hang Seng Index, the stops worked wonderfully, producing great Net Profit/Drawdown ratios. However, I’m not sure if that was related to the stops or simply because I was lucky in designing a good breakout system. Hmm.

Other attempts to combine the stops with my existing systems (such as my Donchian Breakout system) proved to be relatively unsuccessful. This is surprising since the Donchian Breakout system is similar to the regular breakout system, with the exception of adding an additional moving average filter. Neuroshell spat back weird results when I tried to include the ATR trailing stop, somehow the charts got squished – there must be some irregularity in the programming. Also, surprisingly, ratios became worse rather than better. Could it be that the stops take profit too early? I’m really confused and I need to refocus – have to find a more systematic way of combining my entry patterns with stops.

Also, I need to find some new markets for my other systems to trade. So far, my most successful system, the SMA_ATR system (which incorporates an ATR band around a simple moving average), is able to robustly and successfully trade the USD/SGD and the HSI. It can also trade T-Notes and EUR/JPY, but there are relatively fewer trades so it is not enough for me to gauge the statistical significance of the systems’ success rate. (they generated 17 and 11 trades respectively over the test period)

My Donchian Breakout system can trade the SGD and T-Notes, (though I cheated in that market by using Neuroshell’s papertrade function – however the parameters yielded great ratios and good number of trades). It can trade the EUR/JPY and the HSI, but also without enough trades for me to gauge the statistical significance of success.

Goals for now:

1) To find a more robust system that can trade at least 3 markets (with good in-sample and out-sample Net Profit/Max Drawdown ratios), preferably in the areas of currencies (except for USD/SGD and EUR/JPY), in commodities such as oil and Loco London Gold, and in the indexes.

2) To combine my existing Donchian system with some kind of stop system, either a) an ATR stop system, b) an ATR trailing stop system, c) a Volatility Breakout stop system, or any combination of the above.

3) To combine the new systems with my existing stops.

Categories: research

Dennis Gartman Trading Rules

June 22, 2009 · Leave a Comment

Dennis Gartman Trading Rules, taken from Michael Covel’s blog:

1. Never, Ever, Ever, Under Any Circumstance, Add to a Losing Position… not ever, not never! Adding to losing positions is trading’s carcinogen; it is trading’s driving while intoxicated. It will lead to ruin. Count on it!

2. Trade Like a Wizened Mercenary Soldier: We must fight on the winning side, not on the side we may believe to be correct economically.

3. Mental Capital Trumps Real Capital: Capital comes in two types, mental and real, and the former is far more valuable than the latter. Holding losing positions costs measurable real capital, but it costs immeasurable mental capital.

4. This Is Not a Business of Buying Low and Selling High; it is, however, a business of buying high and selling higher. Strength tends to beget strength, and weakness, weakness.

5. In Bull Markets One Can Only Be Long or Neutral, and in bear markets, one can only be short or neutral. This may seem self-evident; few understand it however, and fewer still embrace it.

6. “Markets Can Remain Illogical Far Longer Than You or I Can Remain Solvent.” These are Keynes’ words, and illogic does often reign, despite what the academics would have us believe.

7. Buy Markets That Show the Greatest Strength; Sell Markets That Show the Greatest Weakness: Metaphorically, when bearish we need to throw rocks into the wettest paper sacks, for they break most easily. When bullish we need to sail the strongest winds, for they carry the farthest.

8. Think Like a Fundamentalist; Trade Like a Simple Technician: The fundamentals may drive a market and we need to understand them, but if the chart is not bullish, why be bullish? Be bullish when the technicals and fundamentals, as you understand them, run in tandem.

9. Trading Runs in Cycles, Some Good, Most Bad: Trade large and aggressively when trading well; trade small and ever smaller when trading poorly. In “good times,” even errors turn to profits; in “bad times,” the most well-researched trade will go awry. This is the nature of trading; accept it and move on.

10. Keep Your Technical Systems Simple: Complicated systems breed confusion; simplicity breeds elegance. The great traders we’ve known have the simplest methods of trading. There is a correlation here!

11. In Trading/Investing, An Understanding of Mass Psychology Is Often More Important Than an Understanding of Economics: Simply put, “When they are cryin’, you should be buyin’! And when they are yellin’, you should be sellin’!”

12. Bear Market Corrections Are More Violent and Far Swifter Than Bull Market Corrections: Why they are is still a mystery to us, but they are; we accept it as fact and we move on.

13. There Is Never Just One Cockroach: The lesson of bad news on most stocks is that more shall follow… usually hard upon and always with detrimental effect upon price, until such time as panic prevails and the weakest hands finally exit their positions.

14. Be Patient with Winning Trades; Be Enormously Impatient with Losing Trades: The older we get, the more small losses we take each year… and our profits grow accordingly.

15. Do More of That Which Is Working and Less of That Which Is Not: This works in life as well as trading. Do the things that have been proven of merit. Add to winning trades; cut back or eliminate losing ones. If there is a “secret” to trading (and of life), this is it.

16. All Rules Are Meant To Be Broken…. but only very, very infrequently. Genius comes in knowing how truly infrequently one can do so and still prosper.

Categories: trading philosophy

Don’t Eat The Marshmallow

June 22, 2009 · Leave a Comment

Phillip Zimbardo, the leader of the notorious 1971 Stanford Prison Experiment, gives a talk on how happiness can be achieved based on setting an optimal mix of time perspective factors:

High Past-Positive, Moderately high Future, and Moderate Present-Hedonism

So… we should think deeply about our memories of the marshmallow, enjoy the marshmallow’s presence while it’s there, but wait for the future before we kind of eat it?

Categories: social issues

Inflation? Pfft..

June 21, 2009 · Leave a Comment

New York Times article on why some academics think that inflation may not be as big of a threat as we fear.

Dad has been bullish on gold for some time because of the inflation threat, believing that gold will reach post $1000 levels again. (When inflation rises, the prices of commodities such as gold and oil rise because they are traditionally seen as inflation safeguards) The rationale: The Fed is pumping an extraordinary amount of reserves into the economy and keeping interest rates low, and all things remaining constant, that will lead to a rise in economic activity and inflation. (I’m not sure, but was there runaway inflation in the post-Great Depression era?)

However, it’s true that banks are now too frightened to do anything with the reserves they’ve received but to hoard them. This certainly wouldn’t boost economic activity, so perhaps our inflation fears are overstated. I’m not one to take investment ideas from articles, but perhaps I shouldn’t be so blindly bullish on gold as I was.

Categories: Economics

Trade Your Way To Financial Freedom

June 17, 2009 · Leave a Comment

Am currently reading an excellent trading book “Trade Your Way to Financial Freedom” by Van K. Tharp, after noticing that the name kept popping up in trader interviews in both Market Wizards (by Jack Schwager) as well as the magazine Technical Analysis of Stocks and Commodities. The book didn’t disappoint. While Tharp’s writing style is a little rambly and fluffy (including the use of several stretchy analogies), he covers the most important aspects of trading in great detail: from designing a trading system to entry and exit signals to position sizing and money management. While most trading books dwell on entry signals and/or market timing, Tharp constantly emphasizes exits, stops, and position sizing – factors that are essential for making sure you don’t go bankrupt trading.

It amazes me that even though this book was such a bestseller, the most popular market “experts” are still those that tell you which hot stocks to buy and hold, or how to time your entry into the market, making a rudimentary comment on risk management at best.

The book is geared to the general public, so it covers a wide variety of trading styles, most notably the buy-and-hold value investing style that so many of my friends are practising today. It is obvious, though, that Tharp is a trend-follower at heart, so his writings are slightly skewed to that form of trading. Which works fine for me, since I’m not a big fan of value investing anyway. It was also written in 2006, so some practices might have to be changed or have become invalid due to the financial crisis.

The first five chapters deal with individual psychology, issues that are useful for the trader that’s first starting out. In the next few chapters, Tharp brings up many interesting ideas for entry timing as well as stops, which makes me realize that I have a long way to go in terms of further testing my systems. I have also yet to reach the chapter on exits and position sizing – aspects that Tharp thinks are the most important in trading.  Overall, I think it’s an excellent book for beginners and for people who don’t know which style of trading they’re interested in yet. Don’t expect it to be filled with examples of how to time the market though – there’re probably enough out there.

Categories: research

Just An Update

June 17, 2009 · Leave a Comment

Apologies for not updating for the past week: I haven’t been able to get much research in lately because I was spending the last 4 days with the girlfriend before she flew back to Memphis. Am currently in New York City taking hip-hop classes at Broadway Dance Center. (Yes, I have a life too)

Hopefully I can get some reading and systems testing done while I’m here. Central Park, maybe? There’s something pleasant about doing trading research outdoors in the world’s finance capital. (haha)

Categories: Uncategorized