Announcement

Collapse
No announcement yet.

2007 Jan: Gauging Gap Opportunities

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

  • 2007 Jan: Gauging Gap Opportunities

    File Name: Filled_Gaps.efs

    Description:
    This study is based on the January 2007 Market Pulse article, Gauging Gap Opportunities, by David Bukey.

    Formula Parameters:
    Filled Gap Price Bar Color: lime
    Fill Target Color: blue
    Fill Target Thickness: 2
    Limit for # of bars to fill gap.: 5

    Notes:
    The related article is copyrighted material. If you are not a subscriber of Active Trader Magazine, please visit www.activetradermag.com.


    Download File:
    Filled_Gaps.efs



    EFS Code:
    PHP Code:
    /***************************************
    Provided By : eSignal (c) Copyright 2006
    Description:  Gauging Gap Opportunities 
                  by David Bukey

    Version 1.0  11/10/2006

    Notes:
    * Jan 2007 Issue of Active Trader Magazine
    * Study requires version 8.0 or later.


    Formula Parameters:                     Default:
    Filled Gap Price Bar Color              lime
    Fill Target Color                       blue
    Fill Target Thickness                   2
    Limit for # of bars to fill gap.        5
    *****************************************************************/

    function preMain() {
        
    setPriceStudy(true);
        
    setStudyTitle("Filled Gaps ");
        
    setCursorLabelName("Fill Target"0);
        
    setShowTitleParameters(false);    
        
    setPlotType(PLOTTYPE_FLATLINES0);
        
    setColorPriceBars(true);
        
    setDefaultPriceBarColor(Color.grey);

        var 
    fp1 = new FunctionParameter("nFillColor"FunctionParameter.COLOR);
            
    fp1.setName("Filled Gap Price Bar Color");
            
    fp1.setDefault(Color.lime);
        var 
    fp2 = new FunctionParameter("nColor"FunctionParameter.COLOR);
            
    fp2.setName("Fill Target Color");
            
    fp2.setDefault(Color.blue);
        var 
    fp3 = new FunctionParameter("nThick"FunctionParameter.NUMBER);
            
    fp3.setName("Fill Target Thickness");
            
    fp3.setLowerLimit(1);
            
    fp3.setDefault(2);    
        var 
    fp4 = new FunctionParameter("nLimit"FunctionParameter.NUMBER);
            
    fp4.setName("Limit for # of bars to fill gap.");
            
    fp4.setLowerLimit(1);
            
    fp4.setDefault(5);    
    }

    // Global Variables
    var bVersion  null;    // Version flag
    var bInit     false;   // Initialization flag

    var nFill null;
    var 
    nCount 0;
    var 
    nGap 0;

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

        var 
    nState getBarState();
        
        
    //Initialization
        
    if (bInit == false) {
            
    setDefaultBarFgColor(nColor0);
            
    setDefaultBarThickness(nThick0);
            
    bInit true;
        }
        
        var 
    nH_2 high(-2);
        var 
    nH_1 high(-1);
        var 
    nH_0 high(0);
        var 
    nL_2 low(-2);
        var 
    nL_1 low(-1);
        var 
    nL_0 low(0);
        if (
    nH_2 == null || nL_2 == null) return;


        if (
    nState == BARSTATE_NEWBAR  && nCount 0) {        
            if (
    nGap != 0) {
                
    nCount++;
                if (
    nCount nLimit) {
                    
    nCount 0;
                    
    nGap 0;
                    
    nFill null;
                }
            } else {
                
    nFill null;
            }
        } else if (
    nCount <= 1) {    // first gap bar
            
    if (nL_0 nH_1 ) {
                
    nCount 1
                nFill 
    nH_1;
                
    nGap 1;
                
    drawShapeRelative(0, (nFill+nL_0)/2Shape.UPARROW
                    
    nullColor.rednull"gap"+rawtime(0));
            }
            if (
    nH_0 nL_1 ) {
                
    nCount 1;
                
    nFill nL_1;
                
    nGap = -1;
                
    drawShapeRelative(0, (nFill+nH_0)/2Shape.DOWNARROW
                    
    nullColor.rednull"gap"+rawtime(0));
            }
            if (
    nL_0 <= nH_1 && nH_0 >= nL_1) {
                
    nCount 0;
                
    nFill null;
                
    nGap 0;
                
    removeShape("gap"+rawtime(0));
            }
        }

        if (
    nCount 1) {  // Filled Gap check
            
    if ( (nGap == && nL_0 <= nFill) || (nGap == -&& nH_0 >= nFill) ) {
                
    setPriceBarColor(nFillColor);
                
    nGap 0;
                
    nCount 0;
            }
        }
        
        
        return 
    nFill;
    }


    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;

    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
Working...
X