Filled_Gaps.efs
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:
/*************************************** 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_FLATLINES, 0); 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(nFillColor, nColor, nThick, nLimit) { if (bVersion == null) bVersion = verify(); if (bVersion == false) return; var nState = getBarState(); //Initialization if (bInit == false) { setDefaultBarFgColor(nColor, 0); setDefaultBarThickness(nThick, 0); 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)/2, Shape.UPARROW, null, Color.red, null, "gap"+rawtime(0)); } if (nH_0 < nL_1 ) { nCount = 1; nFill = nL_1; nGap = -1; drawShapeRelative(0, (nFill+nH_0)/2, Shape.DOWNARROW, null, Color.red, null, "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 == 1 && nL_0 <= nFill) || (nGap == -1 && nH_0 >= nFill) ) { setPriceBarColor(nFillColor); nGap = 0; nCount = 0; } } return nFill; } function verify() { var b = false; if (getBuildNumber() < 779) { drawTextAbsolute(5, 35, "This study requires version 8.0 or later.", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "error"); drawTextAbsolute(5, 20, "Click HERE to upgrade.@URL=http://www.esignal.com/download/default.asp", Color.white, Color.blue, Text.RELATIVETOBOTTOM|Text.RELATIVETOLEFT|Text.BOLD|Text.LEFT, null, 13, "upgrade"); return b; } else { b = true; } return b; }