O'Reilly logo

Clojure for Finance by Timothy Washington

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Strategies for Calculating and Manipulating Data

The previous chapter gave us our first introduction to building an equation: a simple moving average. In this chapter, we're going to implement two more functions where the math is only slightly more advanced than the simple moving average (SMA). The exponential moving average (EMA) and Bollinger Bands are both technical trading indicators. These, coupled with the SMA, will give us a nice set of lagging indicators on top of our base stream of stock price data. The moving averages lag price movement because they're based on past data. They smoothen price data and show its current direction by filtering out noise or erratic price points in a time series.

Our first refactor – the price list ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required