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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.