Announcement

Collapse
No announcement yet.

2002 Jul: Zero-Lag Data Smoothers, by John Ehlers

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

  • 2002 Jul: Zero-Lag Data Smoothers, by John Ehlers

    File Name: AdjustableLagFltr.efs

    Description:
    Zero-Lag Data Smoothers, by John Ehlers

    Formula Parameters:
    Lag Reduction: 1.5
    Line Thickness: 2
    Line Color: Green
    Display Cursor Labels: True


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


    Download File:
    AdjustableLagFltr.efs



    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
        eSignal (Copyright c eSignal), a division of Interactive Data 
        Corporation. 2008. All rights reserved. This sample eSignal 
        Formula Script (EFS) is for educational purposes only and may be 
        modified and saved under a new file name.  eSignal is not responsible
        for the functionality once modified.  eSignal reserves the right 
        to modify and overwrite this EFS file with each new release.

    Description:        
        Zero-Lag Data Smoothers, by John Ehlers 

    Version:            1.0  12/05/2008

    Formula Parameters:                     Default:
        Lag Reduction                       1.5
        Line Thickness                      2
        Line Color                          Green
        Display Cursor Labels               True
        
    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 
    bInit false;
    var 
    bVersion null;

    function 
    preMain() {
        
    setPriceStudy(true);
        
    setShowCursorLabel(false);
        
    setShowTitleParametersfalse );
        
    setStudyTitle("Adjustable Lag Fltr");
        
    setCursorLabelName("ALF"0);
        
    setDefaultBarFgColor(Color.red0);
        
    setPlotType(PLOTTYPE_LINE0); 
        
    setDefaultBarThickness(20);

        
    askForInput();
        var 
    x=0;
        
    fpArray[x] = new FunctionParameter("LineColor"FunctionParameter.COLOR);
        
    with(fpArray[x++]){
            
    setName("Line Color");
            
    setDefault(Color.green);
        }    
        
    fpArray[x] = new FunctionParameter("ViewValue"FunctionParameter.BOOLEAN);
        
    with(fpArray[x++]){
            
    setName("Display Cursor Labels");
            
    setDefault(true);
        }    
        
    fpArray[x] = new FunctionParameter("LagReduction"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setName("Lag Reduction");
            
    setLowerLimit(0.01);        
            
    setDefault(1.5);
        }
        
    fpArray[x] = new FunctionParameter("Thickness"FunctionParameter.NUMBER);
        
    with(fpArray[x++]){
            
    setName("Line Thickness");
            
    setLowerLimit(1);        
            
    setDefault(2);
        }
    }

    var 
    nDenominator 0;
    var 
    aCoeff = new Array(7);

    function 
    main(LagReductionThicknessLineColorViewValue) {
    var 
    nNumerator 0;
    var 
    nFilter 0;
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;   

        if ( 
    bInit == false ) { 
            
    setDefaultBarFgColor(LineColor0);
            
    setDefaultBarThickness(Thickness0);
            
    setShowCursorLabel(ViewValue);        
            
    bInit true
        } 

        if (
    getCurrentBarCount() == 1) {
            
    aCoeff[1] = 1;
            
    aCoeff[2] = LagReduction;
            
    aCoeff[3] = LagReduction;
            
    aCoeff[4] = 3;
            
    aCoeff[5] = LagReduction;
            
    aCoeff[6] = LagReduction;
            
    aCoeff[7] = LagReduction;
            
    nDenominator SummationArray(aCoeff7);
        }

        
    nNumerator ;
        for (var 
    nValue1 1nValue1 <= 7nValue1++) {
            
    nNumerator += aCoeff[nValue1] * close(-nValue1 1);
        }
     
        
    nFilter nNumerator nDenominator ;
        return 
    nFilter
    }

    function 
    SummationArray(aArraynLength){
    var 
    nRes 0;
        for (var 
    1<= nLengthi++) {
               
    nRes += aArray[i]; 
        } 
        if (
    nRes == nullnRes 1;
        return 
    nRes;
    }

    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 [email protected]=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;

Working...
X