Announcement

Collapse
No announcement yet.

2011 Feb: The Spearman Indicator For Technical Analysis

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2011 Feb: The Spearman Indicator For Technical Analysis

    File Name: SpearmanIndicator.efs

    Description:
    The Spearman Indicator For Technical Analysis

    Formula Parameters:
    Period: 10


    Notes:
    The related article is copyrighted material. If you are not
    a subscriber of Stocks & Commodities, please visit www.traders.com.


    Download File:
    SpearmanIndicator.efs



    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
        Interactive Data Corporation (Copyright © 2010) 
        All rights reserved. This sample eSignal Formula Script (EFS)
        is for educational purposes only. Interactive Data Corporation
        reserves the right to modify and overwrite this EFS file with 
        each new release. 
        
    Description:        
        The Spearman Indicator For Technical Analysis
     
    Version:            1.0  10/12/2010

    Formula Parameters:                     Default:
        Period                                10
        
    Notes:
        The related article is copyrighted material. If you are not
        a subscriber of Stocks & Commodities, please visit
     [url]www.traders.com.[/url]

    **********************************/

    var fpArray = new Array();
    var 
    bVersion null;
    function 
    preMain()
    {
        
    setStudyTitle("Spearman Indicator");
        
    setCursorLabelName("Spearman Indicator",0);
        
    setCursorLabelName("EMA(3)",1);
        
        
    setDefaultBarFgColor(Color.RGB(0,148,255),0);
        
    setDefaultBarFgColor(Color.red,1);
        
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("gPeriod"FunctionParameter.NUMBER);
        
    with(fpArray[x++])
        {
        
    setName("Period");
        
    setLowerLimit(1);
            
    setDefault(10);
        }
    }

    var 
    vSC2 null;
    var 
    vSC1 null;
    var 
    vSC null;
    function 
    main(gPeriod)
    {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return; 

        if ( 
    getCurrentBarCount() - gPeriod ) return;
        if (
    getBarState() == BARSTATE_NEWBAR)
        {
            
    vSC2 vSC1;
            
    vSC1 vSC;
        }
       
        var 
    r1 = new Array ();
        var 
    r22 = new Array ();
        var 
    r11 = new Array ();
        var 
    r21 = new Array ();
        for ( 
    i=0gPeriodi++ )
        {
                
    r1[i] = gPeriod i;
                
    r22[i] = gPeriod i;
                
    r11[i] = close(gPeriod 1);
                
    r21[i] = close(gPeriod 1);
                
                var 
    i;   
                while (
    && gPeriod)
                {
                    if (
    r21[j]>r21[j-1])
                    {
                        var 
    cBoard r21[j];
                        
    r21[j] = r21[j-1];
                        
    r21[j-1] = cBoard;
                    }
                    else break;
                    
    j--;   
                }
        }
        
        for( 
    0gPeriodi++)
        {
            var 
    found 0;
            while ( 
    found )
            {
                for (
    j=0gPeriodj++)
                {
                    if (
    r21[j]==r11[i])
                    {
                        
    r22[i]=j;
                        
    found=1;
                    }
                }
            }
        }

        var 
    absum 0;
        for ( 
    0gPeriodi++ )
        {
            var 
    ab r1[i] - r22[i];
            var 
    ab2 ab*ab;
            
    absum absum ab2;
        }
        
        var 
    vCoefCorr = (1-(6*absum)/(gPeriod*(gPeriod*gPeriod-1)));    
        
    vSC vCoefCorr*100;
        
        if (
    vSC2 ==null) return new Array(vSC,vSC);
            
        var 
    vSMA3SC = (vSC+vSC1+vSC2)/3;
        return new Array(
    vSCvSMA3SC);
        
    }

    function 
    verify() {
        var 
    false;
        if (
    getBuildNumber() < 779) {
            
    drawTextAbsolute(535"This study requires version 8.0 or later."
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"error");
            
    drawTextAbsolute(520"Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp"
                
    Color.whiteColor.blueText.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT,
                
    null13"upgrade");
            return 
    b;
        } else {
            
    true;
        }
        return 
    b;

    Last edited by eSignal; 01-14-2011, 07:28 AM.
Working...
X