2005 Dec: Overhauling Market Breadth (BRIN.efs)

ICE Data Services -


BRIN.efs  EFSLibrary - Discussion Board
  

File Name: BRIN.efs


Description:
This formula is based on the December 2005 article, Overhauling Market Breadth, by Jacobus R. van den Brink.


Formula Parameters:
Index: NASDAQ [NYSE, NASDAQ]

Notes:
The study plots the Brin, ILine and VLine indicators. The study has one formula parameter that will set the base Index for the indicator calculations between the NYSE and NASDAQ exchanges. This parameter is set to NASDAQ by default. The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

Download File:
BRIN.efs




EFS Code:
/***************************************Provided By : eSignal (c) Copyright 2005Description:  Overhauling Market Breadth - by Jacobus R. van den BrinkVersion 1.0  10/11/2005Notes:December 2005 Issue of Stocks and Commodities Magazine* Study requires version 7.9 or higher.Formula Parameters:                 Defaults:Index                               NASDAQ    [NYSE, NASDAQ]***************************************/function preMain() {    setStudyTitle("BRIN");    setShowTitleParameters(false);    setCursorLabelName("Brin", 0);    setCursorLabelName("ILine", 1);    setCursorLabelName("VLine", 2);    setDefaultBarFgColor(Color.black, 0);    setDefaultBarFgColor(Color.blue, 1);    setDefaultBarFgColor(Color.purple, 2);    setDefaultBarThickness(2, 0);    setDefaultBarThickness(2, 1);    setDefaultBarThickness(2, 2);    setStudyMax(1.3);    setStudyMin(-1.3);    addBand(0, PS_SOLID, 1, Color.black, "0");    addBand(1, PS_SOLID, 1, Color.black, "1+");    addBand(-1, PS_SOLID, 1, Color.black, "1-");        var fp1 = new FunctionParameter("Index", FunctionParameter.STRING);        fp1.setName("Index");        fp1.addOption("NASDAQ");        fp1.addOption("NYSE");        fp1.setDefault("NASDAQ");    }var bVersion = null;var bInit = false;var Brin = null;var ILine = null;var VLine = null;function main(Index) {        if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        if (bInit == false) {        Brin = efsInternal("calcLine", "Brin", Index);        ILine = efsInternal("calcLine", "ILine", Index);        VLine = efsInternal("calcLine", "VLine", Index);        bInit = true;    }        return new Array(getSeries(Brin), getSeries(ILine), getSeries(VLine));}/***** Support Functions *****/var bInitcalcLine = false;var xDnVol = null;var xUpVol = null;var xAdvn = null;var xDecl = null;function calcLine(line, i) {    if (bInitcalcLine == false) {        if (i == "NYSE") {            xDnVol = close(sym("$DVOL"));            xUpVol = close(sym("$UVOL"));            xAdvn = close(sym("$ADV"));            xDecl = close(sym("$DECL"));        } else {            xDnVol = close(sym("$DVOLQ"));            xUpVol = close(sym("$UVOLQ"));            xAdvn = close(sym("$ADVQ"));            xDecl = close(sym("$DECLQ"));        }        bInitcalcLine = true;    }    if (xDnVol == null || xUpVol == null || xAdvn == null || xDecl == null) return;        var DnVol = xDnVol.getValue(0);    var UpVol = xUpVol.getValue(0);    var Advn = xAdvn.getValue(0);    var Decl = xDecl.getValue(0);    var retVal = null;        switch(line) {        case "Brin":            retVal = (1 -(DnVol/UpVol)*(Advn/Decl)) / Math.max(1, (DnVol/UpVol)*(Advn/Decl));            break;        case "ILine":            retVal = (1-Math.pow((Advn/Decl), 2)) / Math.max(1, Math.pow((Advn/Decl), 2));            break;        case "VLine":            retVal = (1-Math.pow((DnVol/UpVol), 2)) / Math.max(1, Math.pow((DnVol/UpVol), 2));            break;    }    return retVal;}function verify() {    var b = false;    if (getBuildNumber() < 700) {        drawTextAbsolute(5, 35, "This study requires version 7.9 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;}