O'Reilly logo

F# for Quantitative Finance by Johan Astborg

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

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 ...

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