/****************************************************************************************************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;} |