Announcement

Collapse
No announcement yet.

Does an efs exist to create a Std. Dev series from another series?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Does an efs exist to create a Std. Dev series from another series?

    I would like to create standard deviation bands around another series. Does anyone know of a function to do that already available?

  • #2
    PHP Code:
    // ------------------------------------
    // Get a StdDev value
    // Parameters:
    //   aSerie  = Series Object
    //   nLength = Length of StdDev
    // ------------------------------------
    function getStdDev(aSerienLength) {
        
    // get average
        
    var vsma sma(nLength,aSerie).getValue(0);
        
    // Compute the numerator inside the square root
        
    var sum 0;
        for (
    i=0i<nLengthi++) {
          
    sum += Math.pow((aSerie.getValue(-i)-vsma), 2);
        }
        var 
    numerator sum;
        
    // Compute the denominator
        
    var denominator 1;
        
    // Compute the value inside the square root
        
    var value numerator denominator;
        
    // Take the square root of the value to find the standard deviation
        
    var stdev Math.sqrt(value);
        return 
    stdev;

    Comment


    • #3
      Here an example:
      Attached Files

      Comment


      • #4
        Apology a mistake is in the Coding.
        Would be correct:

        StdDev.efs

        PHP Code:
            return Math.sqrt(sum/nLength); 
        Function

        PHP Code:
            // Compute the denominator
            
        var denominator nLength
        Sorry

        Comment

        Working...
        X