The Gateway to Algorithmic and Automated Trading

No Signal

Published in Automated Trader Magazine

NO SIGNAL is a regular column where we examine various snafus in the trading, particularly the automated trading world. We look at errors in application logic, mistakes by overzealous co-workers, failures in technology and temporary losses of power to both infrastructure as well as craniums. These all make for good stories that everyone can alternatively either learn from or be amused by - or both. If you have a story that you think makes for a valuable lesson or is simply funny in a facepalm moment kind of way, please get in touch with us at no.signal@trader.news. Naturally, we treat all submissions with the highest confidentiality. We are only interested in the lesson value, or in some cases the humour value, and not in identifying involved parties.

What's the floating point?

Following on from previous stories about problems related to compu­tational accu­racy in financial algorithms, this too is a tale of numerical woe.

Fundamentally, there are two common number formats in computer science: integers and floating point numbers. There are other, less common ways of dealing with numbers inside a computer, but these are not of interest here. For an amusing story about what can go wrong when using integers, the interested reader can refer to the 'No Signal' column in Automated Trader, Issue 39.

Most applications use floating point numbers to represent real numbers. Nowadays, finance is all about squeezing a few basis points (0.0001) from a small rock. This differs somewhat to taking whole (integer) bars of gold, which is apparently what finance used to be. So we often find ourselves dealing with small numbers.

Floating point math comes with a large number of caveats. Few programmers really understand what can go wrong and what they should pay attention to. From rounding issues, to significant digits, to processor and compiler specific problems, it is a veritable minefield for those who are less numerically gifted. There is a standard that is supposed to guide us all - IEEE 754-2008 - but studying this is, in my experience, beyond the ability of most programmers. People just want to get on with calculating stuff, not thinking about the ins and outs of addition or division under the hood.

We'll leave aside the exact nature of rounding issues and problems related to loss of precision and instead focus on what happens when people don't understand the unspecific nature of floating point maths.

A large, unnamed currency hedge fund generated all of its signals through a chunk of legacy code that hadn't changed much since the firm started over a decade ago. The fund was big, and accordingly its signals generated long-term trades.

Long-term signals are usually generated with - drum roll please! - long-term filters. These transform a time series of prices into a slow-moving time series of smoothed data. Common filters include moving averages, Kalman Filters and other, more esoteric menu items (unscented particle filters, anyone?). Quantitative traders are particularly fond of exponential moving averages because they can be cast as a very simple recursive formula:

The remainder of this article is only available to Paid Subscribers

Click here to purchase a subscription to Automated Trader

  • Copyright © Automated Trader Ltd 2017 - Strategies | Compliance | Technology

click here to return to the top of the page