Who to trust: the machine, or me?

Who's smarter - computer or user?  Source: Google Images.

Who’s smarter – computer or user? Source: Google Images.

I suppose it’s a common refrain among newer systematic traders (i.e. those who prefer to have a programmed computer trade on their behalf): when is it OK to override the system I created?

This is particularly on my mind this week, as the volatility of global markets in the first few trading days of 2015 has been a mix of good and bad for my trading system:

  • The good: higher volatility, combined with strong trends (I’m looking at you, oil and euro) has meant several winning positions for my relatively simple momentum system.
  • The bad: despite some decent trends, there have been pretty good reactions/whipsaws in other markets (including equities and bonds).

So here’s my thought process, in the heat of battle, as it were:

  • Rational side: I’ve created a robust system, without fiddling too much with parameters (learning lessons from others).  It works in backtest, and has worked since live trading.  Just keep away from it.
  • Emotional side: I was up $xx in my S&P position, but am now up 75% of $xx.  The trend *looks* like it’s reversing.  Better to get out now, rather than await the inevitable close by the system.
  • Result: A few good discretionary closes, saving a decent chunk of accumulated gains/avoiding loss.  Set against that, a few other discretionary closes led to a bad outcome – fear of missing out.
    • Say I closed a trade in oil, just to see the price continue its downward trajectory.
    • The system wanted to stay short, but I exited early.
    • I get mad at my decision, so get back short at a lower price.
    • The oil price finally does reverse, vindicating my earlier decision to close out early.  But now I’m stuck with a position (that the system still wants, btw) that I don’t want.
    • I close this second, losing trade, again mad at myself for the whole scenario.
    • Overall, these losses offset a decent chunk of the profits saved by discretionary exits.

What to do.  I guess it’s back to work on my system’s exit logic – hopefully my idea for closing out earlier doesn’t completely screw up the system’s profitability.  Regardless, I’ll learn more.

Autonomous agents and genetic algorithms…oh my!

Input = binary.  Output = $$.  Source: Google Images.

Input = binary. Output = $$. Source: Google Images.

The latest book I’m reading is Professional Automated Trading: Theory and Practice by Eugene Durenard.  I’m about a quarter through; in the words of my dad, it’s way cool.

The book has that certain exoticism which probably appeals to a wide range of financial geeks: lots of mentions of hard sciences; passionate disregard of prevailing ‘rule of thumb’ approaches to valuation and trading; and the creation of a robot-army, led by a robot general, to achieve trading success in a landscape filled with chaos and complexity.  If this gets your interest piqued, I suggest purchasing a copy.

OK, back to Earth for a second.  Having not read the full book yet (but the early summaries give a pretty comprehensive overview of what’s to come), I wonder how much of the theory can and does get put into practice.  From the veneered description above, I clearly want to believe the secret to endless trading profits is a fantastically-engineered army of automatons.  However, it’s been my experience from reading more practical trading literature, as well as working in various trading shops, that higher complexity = higher disappointment.  The development cycle I’m accustomed to runs a bit like:

  1. I test a basic hypothesis, such as ‘the oil price trends’.
  2. I come up with a trading rule, having verified #1.  Perhaps a basic breakout strategy.
  3. The basic strategy in #2 looks OK-ish, but I notice a few really bad apples among the backtested trades.  So I create a filter rule to ensure trades like them don’t happen.
  4. I test #3 with the same data.  Perfect.  So now I test out-of-sample data.  Guess what? #3 stinks compared with #2.
  5. Repeat #3 and #4 until I finally give up trying to find a filter rule, and stick with #2.

The idea of continuously-evolving trading robots, or a static robot army led by a continuously-evolving general, sounds a bit like an in-line version of the above sequence.  Maybe, after enough trials, the robot general will beat my logic and analysis – I’m open-minded.  Perhaps that’s why I’m keeping with the book.

In sum: the financial markets offer numerous ways to get very complicated and technical.  Sadly for yours truly, I haven’t yet found a complex ‘golden nugget’ strategy which consistently outperforms more simple trading implementations.  But I keep searching…

What trading strategy suits you? Putting the woo-woo in systematic trading…

I just finished Mechanical Trading Systems by Richard Weissman, which focuses on (who’d have thought) design and use of systematic trading strategies.  The usual mix of momentum, mean reversion and intraday strategies are all here.

What I found more interesting was the author’s pairing of the strategies with trader personality.  The thesis is that certain types of strategy suit different people.  This goes along with my earlier post about return skew: though there are several ways to make money trading, the manner in which returns come can be hard for a person to stomach.

In sum:

  • Momentum: the ‘no vacation’ strategy.  Most trades lose (a small amount of) money, but a few home runs make up for all the losses and then some.  Key is that the home runs are completely unknowable, so you must be in the market at all times.  How do you feel about losing trades 5, 6, 7, 9, etc. times in a row?  Would you keep rolling with the strategy?  How do you keep faith it’s not broken?
  • Mean reversion: made for contrarians.  Benjamin Graham’s Mr. Market becomes over exuberant and depressed without end; your job is to be greedy when others are fearful.  Going against the crowd can be tough, particularly when you’re too early to the trade.  Trade returns tend to be more winners than losers, so that’s some compensation.
  • Intraday: the ‘quick minded’ strategy.  Basically either of the two approaches above (though most go for mean reversion in the intraday context), but with a much-compressed time scale.  Same sorts of emotional issues apply, but with the added stress of needing to make multiple decisions per day (and needing plenty of caffeine).  In my mind, this is where automating the trading becomes absolutely necessary.

As I mentioned before: all these are ways to make a buck.  The question is whether you, as a person, can handle the consistent losses (momentum), the discomfort of going against the crowd (mean reversion), and/or a very stressful lifestyle (intraday).

On a completely tangential note, it was interesting to see the slippage schedule used in the 2008 book was $100 per futures contract, per side.  The market is a lot cheaper these days…

Shortcut time!

I’ve spent a lot of time recently programming, i.e. hitting my head against the wall.  Every time I start working in my (very nice) Python IDE, it takes roughly 30 seconds before I run into the next problem to search Stack Overflow for a solution.  My skills are that bad.

There are times I just need to code a quick trading algorithm, and want ‘good enough’ out of a box.  In comes AmiBroker: a top-spec analysis program which has inbuilt interaction with my execution broker.  The usual technical indicators are built-in, and can be combined easily with the simplified programming language AFL.

Example: I just spent 3 days coding an algorithm in Python, which I just implemented in about 5 minutes using AmiBroker/AFL.  Ahhh…