Extending the application to use Bollinger bands

We'll now extend the application we used in the previous section to use Bollinger bands. Bollinger bands is an extension of moving average, where two bands are added—one upper band and one lower band. The bands are typically K (where K=2.0) times a moving standard deviation above and below the moving average. We need to add a function to calculate the moving standard deviation. We can use the standard deviation from the previous chapter and use it with the Seq.windowed function, as shown in the following code. In this example, we also add legends to specify which data series corresponds to which color. The screenshot is as follows:

Example application extended to use Bollinger Bands

The code looks ...

Get F# for Quantitative Finance now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.