Announcement

Collapse
No announcement yet.

2013 June: Riding The Zigzags by Sylvain Vervoort

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

  • 2013 June: Riding The Zigzags by Sylvain Vervoort

    File Name: SVEHLZZPercent.efs

    Description:
    Riding The Zigzags by Sylvain Vervoort

    Formula Parameters:

    SVEHLZZPercent.efs
    ZigZag percent: 5
    ATR Look back Period: 5
    ZigZag ATR factor: 1.5
    Color of ZigZag lines: blue
    Lines Width: 1

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

    Download File:
    SVEHLZZPercent.efs

    SVEHLZZPercent.efs


    EFS Code:
    PHP Code:
    /*********************************
    Provided By:  
        Interactive Data Corporation (Copyright © 2013) 
        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:        
        High-Low ZigZag indicator
        
    Version:            1.00  10/04/2013

    Formula Parameters:                     Default:
    ZigZag percent                          5
    ATR Look back Period                    5
    ZigZag ATR factor                       1.5
    Color of ZigZag lines                   blue
    Lines Width                             1

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

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


    var pArray = new Array();

    function 
    preMain()
    {

        
    setStudyTitle("High-Low ZigZag indicator"); 
        
    setComputeOnClose();
        
    setPriceStudy(true);

        var 
    0;

        
    pArray[x] = new FunctionParameter("fpZigZagPercentage"FunctionParameter.NUMBER);
        
    with(pArray[x++])
        {
          
    setName("ZigZag percent");
          
    setLowerLimit(0);
          
    setDefault(5);
        }

        
    pArray[x] = new FunctionParameter("fpATRPeriod"FunctionParameter.NUMBER);
        
    with(pArray[x++])
        {
          
    setName("ATR Look back Period");
          
    setLowerLimit(1);
          
    setDefault(5);
        }

        
    pArray[x] = new FunctionParameter("fpATRFactor"FunctionParameter.NUMBER);
        
    with(pArray[x++])
        {
          
    setName("ZigZag ATR factor");
          
    setLowerLimit(0);
          
    setDefault(1.5);
        }

        
    pArray[x] = new FunctionParameter("fpZigZagColor"FunctionParameter.COLOR);
        
    with(pArray[x++])
        {
          
    setName("Color of ZigZag lines");
          
    setDefault(Color.blue);
        }

        
    pArray[x] = new FunctionParameter("fpLineWidth"FunctionParameter.NUMBER);
        
    with(pArray[x++])
        {
          
    setName("Lines Width");
          
    setLowerLimit(1);
          
    setDefault(1);
        }
    }

    var 
    nTrend 0;      

    var 
    nLHb 0;        
    var 
    nLLb 0;        

    var 
    nHH 0;     
    var 
    bLL 0;   

    var 
    nDownlineID 0;   
    var 
    nUplineID 0;  

    var 
    nHLPivot 0;     

    var 
    xATR null;

    var 
    bInit false;
    var 
    bVersion null;

    function 
    main(fpZigZagPercentagefpATRPeriodfpATRFactorfpZigZagColorfpLineWidth)
    {
        if (
    bVersion == nullbVersion verify();
        if (
    bVersion == false) return;

        if(!
    bInit)
        {
            
    xATR atr(fpATRPeriod);

            
    bInit true;
        }

        var 
    nBarNumber getCurrentBarCount();

        if(
    nBarNumber 2)  
        { 
            
    bLL low(0); 
            
    nHH high(0);
            
    nLLb nLHb 1;
            
    nUplineID nDownlineID nBarNumber;
            
    nTrend 1;
            return;
        }

        var 
    nATR xATR.getValue(0);

        if (
    nATR == null)
            return;

        if(
    fpATRFactor == 0)
        { 
            
    nHLPivot fpZigZagPercentage 0.01;
        }
        else
        { 
            if (
    fpZigZagPercentage == 0)
            { 
                
    nHLPivot nATR close(0) * fpATRFactor;
            }
            else
            { 
                
    nHLPivot fpZigZagPercentage 0.01 nATR close(0) * fpATRFactor;
            }
        }

        if (
    nTrend 0)    
        { 
            if (
    high(0) >= nHH
            { 
                
    nHH high(0);
                
    nLHb nBarNumber;

                
    drawLineRelative(-(nBarNumber nLLb), bLL0nHHPS_SOLIDfpLineWidthfpZigZagColornUplineID);
            }
            else if (
    low(0) < nHH nHH nHLPivot
            { 
                
    bLL low(0);
                
    nLLb nBarNumber;
                
    nDownlineID nBarNumber;
                
    nTrend = -1;

                
    drawLineRelative(-(nBarNumber nLHb), nHH0bLLPS_SOLIDfpLineWidthfpZigZagColornDownlineID);
            }
        }
        else 
        {
            if (
    low(0) <= bLL)  
            {
                
    bLL low(0);
                
    nLLb nBarNumber;

                
    drawLineRelative(-(nBarNumber nLHb), nHH0bLLPS_SOLIDfpLineWidthfpZigZagColornDownlineID);
            }
            else if (
    high(0) > bLL bLL nHLPivot)  
            {
                
    nHH high(0);
                
    nLHb nBarNumber;
                
    nUplineID nBarNumber;
                
    nTrend 1;

                
    drawLineRelative(-(nBarNumber nLLb), bLL0nHHPS_SOLIDfpLineWidthfpZigZagColornUplineID);
            }
        }
    }

    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;

Working...
X