Announcement

Collapse
No announcement yet.

How could I adapt this Normalized Standard Deviation...

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

  • How could I adapt this Normalized Standard Deviation...

    How could I adapt this to get the Normalized Accumulation/Distribution or Momentum(12)?

    I wrote my own version of THE NORMALIZER.

    This looks interesting.

    Thanking You in Advance.



    PHP Code:

    /***************************** 
    Provided By : eSignal (c) Copyright 2004 
    Description: Normalized Standard Deviation - Markos Katsanos 

    Version 1.0 

    Notes: 

    Formula Parameters:                     Defaults: 
    Length                                  30 
    Color                                   aqua 
    Thickness                               2 
     **********************************/ 

    function preMain() { 
        
    setStudyTitle("Normalized Standard Deviation "); 
        
    setCursorLabelName("N-Stdev",0); 
      
        
    // Formula Parameters 
        
    var fp1 = new FunctionParameter("Length"FunctionParameter.NUMBER); 
            
    fp1.setName("Period"); 
            
    fp1.setLowerLimit(1); 
            
    fp1.setDefault(30); 

        
    // Study Parameters 
        
    var sp1 = new FunctionParameter("cColor"FunctionParameter.COLOR); 
            
    sp1.setName("Color"); 
            
    sp1.setDefault(Color.aqua); 
        var 
    sp2 = new FunctionParameter("nThick"FunctionParameter.NUMBER); 
            
    sp2.setName("Thickness"); 
            
    sp2.setDefault(2); 


    var 
    bEdit true
    var 
    aValue null
    var 
    vStudy null

    function 
    main(LengthcColornThick) { 
        if (
    bEdit == true) { 
            
    setDefaultBarFgColor(cColor0); 
            
    setDefaultBarThickness(nThick0); 
            
    bEdit false
        } 
      
        if (
    aValue == nullaValue = new Array(Length); 
        if (
    vStudy == nullvStudy = new MAStudy(Length0"Close"MAStudy.SIMPLE); 
      
        var 
    nMA vStudy.getValue(MAStudy.MA); 
        if (
    nMA == null) return; 
      
        var 
    nState getBarState(); 
        var 
    nSum 0
        var 
    ySum 0
        var 
    Basis 0
        var 
    vStdDev 0
      
        if (
    nState == BARSTATE_NEWBAR) { 
            
    aValue.pop(); 
            
    aValue.unshift(close(0)); 
        } 
      
        
    aValue[0] = close(0); 
      
        if (
    aValue[Length-1] == null) return; 
      
        for(
    0Lengthi++){ 
            
    nSum += (aValue[i]); 
        } 
        
    Basis=nSum/Length
      
        for(
    0Lengthi++){ 
            
    ySum += (aValue[i]-Basis)*(aValue[i]-Basis); 
        } 
        
    vStdDev=Math.sqrt(ySum/(Length)); 

        return (
    vStdDev/nMA); 


  • #2
    Why was this moved?

    I put it where it says to ask questions about EFS.

    Comment


    • #3
      Hello Avery,

      The formula code you posted is from the EFS Library. This is the appropriate forum for discussing library formulas.
      Jason K.
      Project Manager
      eSignal - an Interactive Data company

      EFS KnowledgeBase
      JavaScript for EFS Video Series
      EFS Beginner Tutorial Series
      EFS Glossary
      Custom EFS Development Policy

      New User Orientation

      Comment


      • #4
        Ok.. thanks.

        Comment


        • #5
          Hello Avery,

          Sorry for the delay on this one. Here's what you can do. In the pop/unshift routine, notice the source used for this array is close(0)? I think all you would need to do is create a series for the momentum study etc and replace close(0) with the .getValue(0) of the chosen series. You could also rewrite the study and use an sma() series in place of the aValue array. That way you could pass in the momentum series as the source. Give that a shot and let me know if you need any help.
          Jason K.
          Project Manager
          eSignal - an Interactive Data company

          EFS KnowledgeBase
          JavaScript for EFS Video Series
          EFS Beginner Tutorial Series
          EFS Glossary
          Custom EFS Development Policy

          New User Orientation

          Comment

          Working...
          X