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:
The code looks pretty much like the code used in the preceding example; except for the calculation of the upper and lower band, and the moving standard deviation:
/// Another example with Bollinger Bands #r "System.Windows.Forms.DataVisualization.dll" open System...