Automated Trading Algorithms

For the past two months I have been writing my own automated trading system. Two weeks ago I slowly started trading using manual techniques based on data generated by my software. The initial results are very good, but I am tempering down my glee because I was conservative and focused. It’s like those drugs you test to cure cancer that work in smaller trials, but fail in mass scale. My return has been about 33%, with 95% of the trades being in the money. Being the skeptic I am quite nervous about these results because they are too good to be true. Yet I see the monies in my brokerage account and think, interesting. Time will tell if my software is worth its money.

When I saw a column about automated trading systems I was interested. The column asked if trading systems will replace humans. Supposedly there are companies that can develop systems that create rules and generate about 20% return. Not a bad return, but I have funds that are doing better than that and do not use automated trading systems.

The question is if an automated trading system will replace human traders? Let’s say that Progress Apama is the best automated trading system since sliced bread. Why would a company like Progress not use it to trade themselves? This is a serious question that has to be asked. If an automated trading system can be written that generates a guaranteed income why would anybody offer it for sale? The company Progress could use it as a “money printing press” and retire. So right there one should be skeptical of anybody who offers a trading system that makes money. (For those wondering, I am not giving out my software nor the strategies used by it.)

Though there is a market for automated trading systems implying that people are interested in automated trading systems. There is a need, and the title of the HTML page from Progress Apama system says it clearly.

“Progress Apama - Monitor, Analyze, and Act on Events in Under a Millisecond”

The keywords are Act, Events, Millisecond. Humans cannot react to events under a millisecond. If you want to scalp on technical news you need an automated trading system. And Apama seems to be geared towards that market, and that I can understand. However, I would argue that Progress Apama is fighting a loosing battle. I have it from reliable sources that some traders want logic burned onto IC’s because software does not react fast enough for scalping purposes. (NOTE: I do not recommend scalping for the average trader as it seems the big trading houses have taken a bulleyes to this trading style.)

The basis of the Progress Apama software, if you listen to their on demand web casts is that you can generate rules dynamically and make complex decisions based on patterns. My opinion great, but it is not going to help you.

What I have learned from writing my own trading system is that there are no patterns. If there are patterns then they are changing and not reliable. For example one of the things I learned, and it runs counter to the opinions of many, is the need for a large history to properly back-test your trading strategy.

When I started writing my automated trading system I was frustrated that my broker Interactive Brokers provides only a year of history. Thinking that I needed more and more data I grabbed the full historical data from Yahoo. Yet that extra data is not necessary. A large history of a security is bad for your strategy.

The reason has to do with trading psychology. Let’s say that two years ago there was a pattern to buy. Traders will see the pattern and to make “real money” do the inverse and sell. As more and more traders see the pattern there will be more and more sellers invalidating the pattern. The signal of the pattern changes and your software will not know whether to buy or sell. Let’s put it to the brutal test. Would you want to use trading strategies from the pre-Internet bubble? NOT LIKELY!

This pattern inversion is why the markets are random walks. There are moments of markets inefficiency, but it is very hard to predict those moments. This is why some human traders are so good as they can sense these inefficiencies and know what action to take. To figure out the market many software products and automated trading systems attempt to cross-reference and correlate other information in the hopes of finding a pattern. Yet that extra information is useless because if that extra information establishes a pattern it will be exploited and thus loose its relevance. Patterns are a loosing battle!

When I initially read the book “Technical Analysis and the Financial Market” I learned the following fundamental rules.

  1. Market action discounts everything
  2. Prices move in trends.
  3. History repeats itself.

The first rule throws the relevance of extra information from additional data streams out the window. The first rule says that market action is a collective of all informations, and thus any other extra information is not going to help you. At first when I thought about this rule I thought it ain’t so. But in fact it is so, and my automated trading system illustrated it to me.

The second rule is one that we are all aware of and relates to the fact that once a trend has established itself it will keep going. The second rule is the basis of trend trading and I have no argument with this rule.

The third rule is that history repeats itself. I completely agree, but would be defeating my own argument and imply that companies like Progress Apama are correct. What I learned from my software is that history repeats itself, but how history plays out is different. Anybody who trades or invests will probably once or twice have said, “Hey this company is good so why are the stocks falling?”

What I have learned is that trading involves the combination of random walks, and technical analysis. The problem with combining these two strategies is that they are contradictory. Combining the two theories I am saying you can analyse a random event. Using the extreme case of lotteries it means I can predict what numbers are going to be drawn and as we all know that is impossible.

It is possible to combine the two and my software illustrates how it can be done by analysing the recent DELL earnings. Consider the following snapshot of the DELL analysis before and after the earnings. For reference purposes based on my trading software I implemented a strategy and made 50% overnight returns.

Until 21.11.2006 my software was saying the trading sentiment was negative. The first two columns after the date column are the feelings of traders, where in the short term some were undecided, and long term they were negative. The next two columns represent the short and long term actions of the traders which were negative. Moving along and skipping the numbers look at the number 23.36, which is a volatility number. In my trading system anything above 20 is very very high meaning that the stock could go in either direction.

What my data was telling me is that the traders were negative and undecided. How do you trade this situation? If you attempt to associate a pattern from a book like “Encyclopedia of Chart Patterns” with the situation then you will either be very right or very wrong. And if you are sure of the very right situation then you are probably doing insider trading. The only logical answer is that at this point the market is a random walk.

Longer term chart technicians would have had a bullish position on DELL since the trend was positive as illustrated by the following snapshot.

I agree the trend is bullish, but the earnings could have gone either way.

For example, AAPL was on a downward trend until July 2006, and then AAPL switched directions.

I am making the case for trend following when the stocks illustrate trend characteristics, but looking at GOOG since 2006 it has been doing a sideways push. You could have followed the shorter term trends, but then comes the question what is the appropriate trend length to follow?

The answer is you don’t know what the appropriate trend length is because the market is a random walk. Trend following does attempt to define boundaries of when to buy and sell. Yet even trend following has its problems. This goes back to my thinking that if there are patterns where traders make money, other traders will do the inverse and punish you for it.

From the books “Technical Analysis of the Financial Markets”, “Technical Analysis and the Active Trader”, “Trading for a Living”, and “Investments” and trading I am learning that the market;

  • discounts everything,
  • there are trends,
  • markets are random walks,
  • risk calculations are essential,
  • its not about software, but about the strategy.

When I troll the Interactive Broker bulletin boards many ask about automated trading systems. And the most common answer is, “first focus on the strategy, then on the software.” And guess what, they are right. Software is a tool to help you slice and dice the data, but it cannot trade for you. As a tip I recommend reading the books I mentioned because they are very insightful and interesting.

Hello There Mr Roboto!
(the song and era says it all... http://www.devspace.com)

Wednesday, Nov. 29, 2006 by Christian

Related Articles

22 Comments Add your ownSubscribe

  • 1. Steve  |  November 29th, 2006 at 3:55 pm

    Great article again Christian.

    I created my strategy and then wrote the software to follow my strategy. I agree that that is probably the best way to go. The nice thing about the software, which is what I’m sure you’re seeing too, is that it take the emotion and the second guessing out of things. It tells you exactly what you should do based on your strategy. Then the decision comes down to whether you want to or not. My program is telling me to take profit out of Apple, but my gut is telling me to wait.

    Good luck on the software, sounds like yours is way more thorough than mine. :)

    Invest in peace…

  • 2. Christian  |  November 29th, 2006 at 4:52 pm

    Funny you mention emotions. That is exactly the reason why I decided to write the software. Before when I was trading by hand I was relatively profitable. Then when I took it up a notch I made some big losses. I did not loose any money, just that a third of gains were eaten. BTW I hate loosing. At that point I decided to call it quits for a month and stopped trading. Somebody said that it is a good thing that I did because it shows I don’t have a gambling addict habit as most people would try vainly to get those gains back.

    In two weeks I plan on taking my software live for my trading. Right now I was in beta test mode and traded using a controlled environment.

    You mention Apple, and I decided to put my software to the test. So PLEASE take this with a grain of salt as I could be completely wrong. But tell me in a couple of weeks or so how the stock and advice is doing as I would like some feedback.

    As of today a negative mood crossed Apple. The switch occurred yesterday. Though it seems the long term mood is mixed, has been for the past month or so. BTW my shorter term is 5-8 trading sessions and longer term is 21 to 30 trading sessions.

    The funny thing about Apple is that the data is telling me Apple is entering a trading range between 87 and 95. I looked at the charts and thought, duh you already know that. However the software first pin-pointed the trading range on 22 November.

    Here is my thinking. Put in a stop limit somewhere in the range of 87.04 and 87.91. Whatever suits your fancy. If you want to be a bit tighter 89.01 is another number that my application spit out.

    Tell me if anything comes out of this, but remember I have no clue and this data is provided without any real clue, ok.

  • 3. Jason  |  December 1st, 2006 at 2:13 pm

    I’m so jealous. I need to get me some trading software. I’ve dabbled a bit in the past and may break out some of that code or just start over.

  • 4. Jason  |  December 1st, 2006 at 2:17 pm

    One more question. I may be confused if it’s one of you or Ugly from uglycharts.com (who also posts occasionally about some trading software he’s working on), but I remember someone talking about APIs to brokers, etc.

    Does either of your software actually make trades or is it just used as a tool?

    My personal feelings are that the tool-based applications, rather than fully autonomous trading agents, are going to offer the best returns. When I played a lot of online poker, I used applications like PokerTracker and programs that overlaid stats to aid my game. Making that data available to me in permutations that are immediately useful helped my game a lot. In an instant, I could get a good guess as to what a player’s style was and from that could make a decision on how to play. I imagine the process would be very similar with custom-built trading tools.

  • 5. Steve  |  December 1st, 2006 at 2:53 pm

    Mine’s just a tool. I wouldn’t want a computer making trades for me. :) I just hit a button and it prints out what I should do. Easy stuff. Then I make up my mind and decide whether to do what the program says or not.

    - Steve

  • 6. Christian Gross  |  December 1st, 2006 at 4:10 pm

    Right now the program is indicating when I should jump. Today was my first day trading… And what happens? The market gets WHACKED! I was down by 5%, but managed to eek out a 1% day trading, but had to double, triple down! UGH!

    Though I did make 5K in a week trading OIL (ON PAPER!) A single oil contract is a bit rich for my blood. I like to be able to buy multiple contracts so that if necessary like today I can double, or triple down.

    Would I let the computer make my trades? Actually yes! Had I followed the advice of my software and been a bit faster then I would have made a nice chunk of change. My software was telling me that QQQQ had a pivot point of 44.00, and support point of 43.78. Na ja what can you say on the first day of trading with my software. Bugs need to be worked out.

    I heard it through the woodwork that traders were complaining that the computers were not fast enough. They all wanted to short this run and I am guessing the system overloaded. Na ja…

  • 7. Phil John  |  December 5th, 2006 at 12:16 am

    Congrats on the winnings - to make 1% when the market is moving down at 5% is a really good result.

    Phil

  • 8. Christian Gross  |  December 6th, 2006 at 10:30 am

    Phil: Thanks… I was in a panic, but then did something Cramer said he did as a hedge fund trader. And it worked out… I don’t think I would do it all the time, but in that case it did save me

  • 9. Kevin  |  September 29th, 2007 at 2:54 pm

    what are the borkers who provides auto-trading APIs to build auto trading SW and what are pros & cons of these APIs? Any insight would be very much appreciated!

  • 10. off track betting clarksv&hellip  |  October 30th, 2007 at 4:58 am

    off track betting clarksville…

    postlude microprocessors shelves introspective …

  • 11. mitchell harstad od&hellip  |  October 30th, 2007 at 6:36 am

    mitchell harstad od…

    flares!stepmothers Paulo visits graded …

  • 12. imagen casino vegas&hellip  |  February 10th, 2008 at 3:14 am

    imagen casino vegas…

    belles miscarriage practicably mansion …

  • 13. pet insurance health plan&hellip  |  February 19th, 2008 at 3:35 pm

    pet insurance health plan cost…

    terminates scaffold disorder …

  • 14. mobile home insurance uk&hellip  |  February 23rd, 2008 at 5:44 am

    mobile home insurance uk…

    shapes impervious overhaul entertainments gassing advantage:…

  • 15. health insurance for low &hellip  |  February 27th, 2008 at 2:39 pm

    health insurance for low income people in pa…

    fixedly inorganic:companionship surprised strainer …

  • 16. bingo hall in florissant &hellip  |  February 28th, 2008 at 8:55 pm

    bingo hall in florissant mo…

    surgically swerves pattern stung …

  • 17. bestes online kasino&hellip  |  March 22nd, 2008 at 7:53 pm

    bestes online kasino…

    tilling gild reactivation breakthrough interpretively interchanger …

  • 18. uk car insurance companie&hellip  |  March 23rd, 2008 at 10:25 pm

    uk car insurance companies…

    loving assail disjunctively …

  • 19. black jack purcell&hellip  |  April 22nd, 2008 at 4:21 am

    black jack purcell…

    reversal bulletins Marcel Corinth?…

  • 20. Order phentermine from uk&hellip  |  April 30th, 2008 at 12:59 pm

    Order phentermine from uk….

    Order phentermine online uk. Phentermine uk….

  • 21. stampede video slot&hellip  |  May 23rd, 2008 at 10:23 am

    stampede video slot…

    botanical Tahiti workshops?twain …

  • 22. telecharger evrest poker&hellip  |  June 24th, 2008 at 4:40 am

    free ringtones software…

    Les poker sexi gratis casino on net free real ringtones for verizon strip poker golden palace online casino…

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Subscribe without commenting

Trackback this post  |  Subscribe to the comments via RSS Feed


Join our mailing list now:

Check it Out

Financial Web - The Independent Financial Portal
Know the best credit cards for bad credit? Looking for the cheapest cash-advance loans? Interested in FOREX trading?

Calendar

November 2006
M T W T F S S
« Oct   Dec »
 12345
6789101112
13141516171819
20212223242526
27282930  

Most Recent Articles

Business Blog Top Sites
Moo!