Standard Deviation indicators – minor fix.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #127079 quote
    Vonasi
    Moderator
    Master

    I posted three indicators to the library that all carry out various standard deviation calculations. I have just found out that there are two ways to calculate standard deviation – one way when calculating it on populations and another way when calculating it on data samples. I appear to have used the wrong one in the code. The difference is only minor and at the last step of the calculation:

    • population version:                   standard deviation = sqrt(total/(p-1))
    • data sample version:                 standard deviation = sqrt(total/(p))

    The difference in the results is very tiny but some may prefer the more correct calculation so rather than ask Nicolas to change all the library posts I will just post modified versions of the indicator ITF files here and add a link in each library posts comments.

    GraHal and Gianluca thanked this post
    MTF-SMA-and-STD-v2.2.itf MTF-SMA-and-STD-Bounded-v1.1.itf Fractal-STD-Bands-v2.1.itf
    #173615 quote
    JS
    Participant
    Senior

    It is just the other way round:

    When you calculate the standard deviation and uses  the whole population then divide by N

    When using a data sample (part of the whole data) divide by (N-1)

    The statistical error (not using all data) tends to reduce the calculated value of the SD, to compensate for this use (N-1) instead of N.

    If N is small the statistical error will be very large…!!!

    The difference is not at the last step but already begins when you calculate the mean…(you must calculate the mean before you can calculate the SD)

    The standard deviation in PRT under Indicators uses the N- deviation which is actually wrong because you always use a data sample (of the whole population) so you must divide by (N-1).

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Standard Deviation indicators – minor fix.


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Vonasi @vonasi Moderator
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by JS
4 years, 7 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/20/2020
Status: Active
Attachments: 3 files
Logo Logo
Loading...