How to efficiently calculate a moving Standard Deviation

前端 未结 4 1322
刺人心
刺人心 2020-12-24 07:46

Below you can see my C# method to calculate Bollinger Bands for each point (moving average, up band, down band).

As you can see this method uses 2 for loops to calcu

4条回答
  •  半阙折子戏
    2020-12-24 08:06

    Most important information has already been given above --- but maybe this is still of general interest.

    A tiny Java library to calculate moving average and standard deviation is available here: https://github.com/tools4j/meanvar

    The implementation is based on a variant of Welford's method mentioned above. Methods to remove and replace values have been derived that can be used for moving value windows.

    Disclaimer: I am the author of the said library.

提交回复
热议问题