Hello, Algo-trading !

We’re officially live on the trading floor and to celebrate, we decided to inaugurate this blog with a post-mortem of sorts. ENZO Bot is our very own trading system that automates the task of trading currencies, operating autonomously 24/7, without human intervention.

ENZO Bot development desk

Here’s a quick report based on our own experience. For this time, we’ll focus mostly on the topic of trading algorithms. These are rather generic suggestions, but they may come handy for anyone that is approaching the field.

There are many ways to do algorithmic (or quantitative) trading, depending on the frequency of operation, the level of automation and application to different markets. Our main focus was to develop a completely autonomous system taking human bias out of the equation and replacing it instead with code and elements of machine learning.

Algo trading is today increasingly more accessible by almost anyone willing to license a trading software or that can do some Python programming. Virtually anyone could come up with a winning system that provides a good streak on some market. In practice, however, it’s incredibly easy to develop algorithms that are exceptional only on paper, but unsuccessful when applied to the actual market. This is because trading algos are developed around historical data, so, it’s extremely common to end up writing a program that works well on past events, but not for the future, where it really counts. This is also know as overfitting.

Everyone is bound to fall prey of overfitting and to some degree this will continue to happen one way or another. It’s a constant struggle that one minimizes with experience and with method. In any case, here are a few simple suggestions of our own, regarding testing and development:

  • Optimize on one data set, but also test other data sets (different periods, with different general trends). See how an algorithm built around some data performs with other data. If performance is bad, chances are that you optimized too close to the original data set.
  • Beware of great results. Pump on the brakes ! ABS: Always Be Skeptical. Ask yourself why is the performance is so good? Don’t take the easy win at face value. Debug the good, not just the bad.
  • Visualize the results graphically. Zoom in on the trading spots. Are you simulating a buy at an improved price? It happened to us, it’s initially funny, then demoralizing: cheating without knowing it, it was all a lie, back to the drawing board !
  • Be paranoid about your testing infrastucture. Reliable back-testing is the single most important element. A logical bug in back-testing will not make the system crash, but it will trick you into thinking that you have built a great algo, while instead you were maybe just introducing some prediction bias somewhere into the pipeline.
  • Prefer simplicity. As an algorithm is improved, more and more special rules and parameters are added to it. This is only natural, but beware of overloading the algo with rules, especially those that only give the occasional improvement here and there. Each rule is a specialization, each specialization can be a rigidity, an obstacle, added to the system.
  • Favor global performance over local performance. This becomes obvious with long term testing but, nonetheless, avoid those rules that increase profit for a specific situation, if they actually make things worse overall. Try to understand why such rule is counter-productive. Always think of the bigger picture, even if it means giving up on some obvious wins.
  • Start as a human, then embrace the borg. Classical Technical Analysis (TA) has some value to it, but it should be considered more as a rite of passage than an actual doctrine to follow. TA can be very ambiguous and therefore misleading (Evidence-Based Technical Analysis talks extensively about this). TA aside, some common sense “human” rules and intuitions are often just counter-productive, but are valuable to get a sense of what’s wrong with trivial intuitions.
  • Be creative, but also pragmatic. Algorithmic trading is intriguing but very open-ended. It’s an attractive field of research that can drag one into some deep rabbit holes. One has to find the right balance between the latest buzz-word and forever tweaking the same old algorithm. As with any sensible R&D, it’s important to explore all avenues, but also to keep a safe tried-and-true line on which to rely on.
  • Be prepared for a roller coaster ride. All of the development can be hard and challenging, but when it comes to the algorithms, there is also a constant veil of uncertainty that adds to the stress. Something may seem to work great, until some new test data is available or some logic bug is discovered, then the bubble bursts, everything is wrong again. It’s a constant switch between “OMG. I’m going to make money !” and “OMG. I’m going to lose money !”.

Notably missing from the suggestions is the classical and obvious “remember to consider the trading commission in the simulation”. That’s definitely the first thing that one should put into the back-testing system, no question about it.

We plan on posting more in detail about our system as it is and as how it’s going to progress. For any info, feel free to contact us at the links below.

Happy trading !

Written on May 8, 2018