2006 Mar Bonus Issue: Bandwidth Volatility Extremes

ICE Data Services -


extremeBandwidth.efs, extremeBWdirectional.efs  EFSLibrary - Discussion Board
  

File Name: extremeBandwidth.efs, extremeBWdirectional.efs


Description:
These studies are based on the March 2006 Bonus Issue article, Bandwidth Volatility Extremes, by Barbara Star, Ph.D.


Formula Parameters:
extremeBandwidth.efs
XBB Length: 8
BB Length: 20
Standard Deviations: 2

extremeBWdirectional.efs
XBB Length: 8
BB Length: 20
Standard Deviations: 2
Image Size: Large [Large, Small]

Notes:
The original Bollinger Bandwidth study that is compared to the extreme Bandwidth study can be found in \eSignal\Formulas\Bollinger\Bandwidth.efs. These formula studies require eSignal version 7.9 or later. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

Download Files:
extremeBandwidth.efs
extremeBWdirectional.efs






EFS Code:








/****************************************************************************************************Copyright � eSignal, a division of Interactive Data Corporation. 2005. All rights reserved. This sample eSignal Formula Script (EFS) may be modified and saved under a new filename; however, eSignal is no longer responsible for the functionality once modified.eSignal reserves the right to modify and overwrite this EFS file with each new release.*****************************************************************************************************/function preMain() {    setStudyTitle("Extreme BandWidth");    setCursorLabelName("XBW", 0);    setDefaultBarFgColor(Color.blue);    setDefaultBarThickness(2);    addBand(35, PS_DOT, 2, Color.black, 35);    addBand(-30, PS_DOT, 2, Color.black, -30);        var fp0 = new FunctionParameter("nXBBLen", FunctionParameter.NUMBER);        fp0.setName("XBB Length");        fp0.setLowerLimit(1);        fp0.setDefault(8);    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);        fp1.setName("BB Length");        fp1.setLowerLimit(1);        fp1.setDefault(20);    var fp2 = new FunctionParameter("nStdv", FunctionParameter.NUMBER);        fp2.setName("Standard Deviations");        fp2.setLowerLimit(0);        fp2.setDefault(2);}var bInit = false;var xRoc = null;var xbbw = null;var bbUpper = null;var bbLower = null;var bbMiddle = null;function main(nXBBLen, nLength, nStdv) {    if (bInit == false) {        xbbw = efsInternal("bbw", nLength, nStdv);        xRoc = roc(nXBBLen, xbbw);        bInit = true;    }        return xRoc.getValue(0);}function bbw(n, s) {    bbUpper = upperBB(n, s);    bbLower = lowerBB(n, s);    bbMiddle = middleBB(n, s);    return (bbUpper.getValue(0) - bbLower.getValue(0)) / bbMiddle.getValue(0) * 100;}/****************************************************************************************************Copyright � eSignal, a division of Interactive Data Corporation. 2005. All rights reserved. This sample eSignal Formula Script (EFS) may be modified and saved under a new filename; however, eSignal is no longer responsible for the functionality once modified.eSignal reserves the right to modify and overwrite this EFS file with each new release.*****************************************************************************************************/function preMain() {    setPriceStudy(true);    setStudyTitle("Extreme BandWidth Directional");    setCursorLabelName("XBW", 0);    setCursorLabelName("SMA", 1);    setCursorLabelName("Upper BB", 2);    setCursorLabelName("Lower BB", 3);    setDefaultBarFgColor(Color.blue, 0);    setDefaultBarFgColor(Color.red, 1);    setDefaultBarFgColor(Color.red, 2);    setDefaultBarFgColor(Color.red, 3);    setDefaultBarThickness(2, 0);    setDefaultBarThickness(1, 1);    setDefaultBarThickness(1, 2);    setDefaultBarThickness(1, 3);        var fp0 = new FunctionParameter("nXBBLen", FunctionParameter.NUMBER);        fp0.setName("XBB Length");        fp0.setLowerLimit(1);        fp0.setDefault(8);    var fp1 = new FunctionParameter("nLength", FunctionParameter.NUMBER);        fp1.setName("BB Length");        fp1.setLowerLimit(1);        fp1.setDefault(20);    var fp2 = new FunctionParameter("nStdv", FunctionParameter.NUMBER);        fp2.setName("Standard Deviations");        fp2.setLowerLimit(0);        fp2.setDefault(2);    var fp3 = new FunctionParameter("sSize", FunctionParameter.STRING);        fp3.setName("Image Size");        fp3.addOption("Large");        fp3.addOption("Small");        fp3.setDefault("Large");}var bInit = false;var xRoc = null;var xbbw = null;var xMiddleBB = null;var xUpperBB = null;var xLowerBB = null;var xMa = null;var bbUpper = null;var bbLower = null;var bbMiddle = null;var nCntr = 0;var nAboveBar1 = null;var nBelowBar1 = null;var nSize = 14;function main(nXBBLen, nLength, nStdv, sSize) {    if (bInit == false) {        xbbw = efsInternal("bbw", nLength, nStdv);        xRoc = roc(nXBBLen, xbbw);        xMa = sma(18);        xMiddleBB = middleBB(nLength, nStdv);        xUpperBB  = upperBB(nLength, nStdv);        xLowerBB  = lowerBB(nLength, nStdv);        bInit = true;    }        if (getBarState() == BARSTATE_NEWBAR) nCntr++;        var nRoc = xRoc.getValue(0);    var nRoc_1 = xRoc.getValue(-1);    var nMa = xMa.getValue(0);    if (nRoc == null || nRoc_1 == null || nMa == null) return;        if (nAboveBar1 == null && xUpperBB.getValue(0) != null) {        nAboveBar1 = nBelowBar1 = (xUpperBB.getValue(0) - xLowerBB.getValue(0)) * .07;    }        // extreme Narrow Upper    if (nRoc < -30 && nRoc_1 > -30 && close(0) > nMa) {        if (sSize == "Small") {            drawShapeRelative(0, high(0)+nAboveBar1, Shape.DIAMOND, null, Color.red, Shape.BOTTOM, "nu"+nCntr);        } else {            drawTextRelative(0, high(0)+nAboveBar1, "u", Color.red, null,                 Text.CENTER|Text.VCENTER|Text.BOLD|Text.ONTOP, "Wingdings", nSize, "nu"+nCntr);        }    } else {        removeShape("nu"+nCntr);    }        // extreme Narrow Lower    if (nRoc < -30 && nRoc_1 > -30 && close(0) < nMa) {        if (sSize == "Small") {            drawShapeRelative(0, low(0)-nBelowBar1, Shape.DIAMOND, null, Color.red, Shape.TOP, "nl"+nCntr);        } else {            drawTextRelative(0, low(0)-nBelowBar1, "u", Color.red, null,                 Text.CENTER|Text.VCENTER|Text.BOLD|Text.ONTOP, "Wingdings", nSize, "nl"+nCntr);        }    } else {        removeShape("nl"+nCntr);    }    // Wide Upper    if (nRoc > 35 && nRoc_1 < 35 && close(0) > nMa) {        if (sSize == "Small") {            drawShapeRelative(0, high(0)+nAboveBar1, Shape.DIAMOND, null, Color.blue, Shape.BOTTOM, "wu"+nCntr);        } else {            drawTextRelative(0, high(0)+nAboveBar1, "u", Color.blue, null,                 Text.CENTER|Text.VCENTER|Text.BOLD|Text.ONTOP, "Wingdings", nSize, "wu"+nCntr);        }    } else {        removeShape("wu"+nCntr);    }        // Wide Lower    if (nRoc > 35 && nRoc_1 < 35 && close(0) < nMa) {        if (sSize == "Small") {            drawShapeRelative(0, low(0)-nBelowBar1, Shape.DIAMOND, null, Color.blue, Shape.TOP, "wl"+nCntr);        } else {            drawTextRelative(0, low(0)-nBelowBar1, "u", Color.blue, null,                 Text.CENTER|Text.VCENTER|Text.BOLD|Text.ONTOP, "Wingdings", nSize, "wl"+nCntr);        }    } else {        removeShape("wl"+nCntr);    }        return new Array(nRoc.toFixed(4), xMiddleBB.getValue(0), xUpperBB.getValue(0), xLowerBB.getValue(0));}function bbw(n, s) {    bbUpper = upperBB(n, s);    bbLower = lowerBB(n, s);    bbMiddle = middleBB(n, s);    return (bbUpper.getValue(0) - bbLower.getValue(0)) / bbMiddle.getValue(0) * 100;}