2007 Jul: Between Price And Volume

ICE Data Services -


VPCI.efs, VPCI_Smoothed.efs, VPCI_Bollinger.efs  EFSLibrary - Discussion Board
  

File Name: VPCI.efs, VPCI_Smoothed.efs, VPCI_Bollinger.efs


Description:
These studies are based on the July 2007 article, Between Price And Volume, by Buff Dormeier.


Formula Parameters:
VPCI.efs
Long-term Period: 50
Short-term Period: 10
Color: blue
Thickness: 2

VPCI_Smoothed.efs
Long-term Period: 50
Short-term Period: 10
VPCI Color: blue
VPCI MA Color: grey
Thickness: 2

VPCI_Bollinger.efs
Long-term Period: 50
Short-term Period: 10
Bollinger Period: 10
Bollinger Stdev: 2
VPCI Color: blue
Bollinger Band Color: red
Thickness: 2

Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.

Download File:
VPCI.efs
VPCI_Smoothed.efs
VPCI_Bollinger.efs








EFS Code:

VPCI.efs














/***************************************Provided By :     eSignal (Copyright ) eSignal), a division of Interactive Data     Corporation. 2007. All rights reserved. This sample eSignal     Formula Script (EFS) is for educational purposes only and may be     modified and saved under a new filename.  eSignal is not responsible    for the functionality once modified.  eSignal reserves the right     to modify and overwrite this EFS file with each new release.    Description:  Between Price And Volume              by Buff DormeierVersion 1.0  5/08/2007Notes:* July 2007 Issue of Stocks and Commodities Magazine* Study requires version 8.0 or later.Formula Parameters:                     Default:Long-term Period                        50Short-term Period                       10Color                                   blueThickness                               2***************************************/function preMain() {    setStudyTitle("VPCI ");    setShowTitleParameters(false);    setCursorLabelName("VPCI", 0);    addBand(0, PS_SOLID, 2, Color.grey, "zero");    var fp1 = new FunctionParameter("nLongP", FunctionParameter.NUMBER);        fp1.setName("Long-term Period");        fp1.setLowerLimit(1);        fp1.setDefault(50);    var fp2 = new FunctionParameter("nShortP", FunctionParameter.NUMBER);        fp2.setName("Short-term Period");        fp2.setLowerLimit(1);        fp2.setDefault(10);    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);        fp3.setName("Color");        fp3.setDefault(Color.blue);    var fp4 = new FunctionParameter("nThick", FunctionParameter.NUMBER);        fp4.setName("Thickness");        fp4.setLowerLimit(1);        fp4.setDefault(2);}// Global Variablesvar bVersion  = null;    // Version flagvar bInit     = false;   // Initialization flagvar xVPC = null;var xVPR = null;var xVM  = null;var nVPCI = null;function main(nLongP, nShortP, cColor, nThick) {    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        //Initialization    if (bInit == false) {        setDefaultBarFgColor(cColor, 0);        setDefaultBarThickness(nThick, 0);        xVPC = efsInternal("calcVPC", nLongP);        xVPR = efsInternal("calcVPR", nShortP);        xVM  = efsInternal("calcVM",  nLongP, nShortP);        bInit = true;    }    var nState = getBarState();    var nIndex = getCurrentBarIndex();    var nVPC = xVPC.getValue(0);    var nVPR = xVPR.getValue(0);    var nVM  = xVM.getValue(0);    if (nVPC == null || nVPR == null || nVM == null) return;        nVPCI = nVPC * nVPR * nVM;        setBarBgColor(Color.cyan, 0, 0, Infinity*1);        return nVPCI;}function calcVPC(n) {    var nVwma = vwma(n, 0);    var nSma  = sma(n, 0);    if (nVwma == null || nSma == null) return;        return (nVwma - nSma);}function calcVPR(n) {    var nVwma = vwma(n, 0);    var nSma  = sma(n, 0);    if (nVwma == null || nSma == null) return;        return (nVwma / nSma);}function calcVM(nL, nS) {    var nVolSma1 = sma(nL, volume(), 0);  // long term     var nVolSma2 = sma(nS, volume(), 0);  // short term    if (nVolSma1 == null || nVolSma2 == null) return;        return (nVolSma2 / nVolSma1);}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;}

VPCI_Smoothed.efs

/***************************************Provided By:     eSignal (Copyright ) eSignal), a division of Interactive Data     Corporation. 2007. All rights reserved. This sample eSignal     Formula Script (EFS) is for educational purposes only and may be     modified and saved under a new filename.  eSignal is not responsible    for the functionality once modified.  eSignal reserves the right     to modify and overwrite this EFS file with each new release.    Description:  Between Price And Volume              by Buff DormeierVersion 1.0  5/08/2007Notes:* July 2007 Issue of Stocks and Commodities Magazine* Study requires version 8.0 or later.Formula Parameters:                     Default:Long-term Period                        50Short-term Period                       10VPCI Color                              blueVPCI MA Color                           greyThickness                               2***************************************/function preMain() {    setStudyTitle("VWMA of VPCI ");    setShowTitleParameters(false);    setCursorLabelName("VPCI", 0);    setCursorLabelName("VPCI VWMA", 1);    var fp1 = new FunctionParameter("nLongP", FunctionParameter.NUMBER);        fp1.setName("Long-term Period");        fp1.setLowerLimit(1);        fp1.setDefault(50);    var fp2 = new FunctionParameter("nShortP", FunctionParameter.NUMBER);        fp2.setName("Short-term Period");        fp2.setLowerLimit(1);        fp2.setDefault(10);    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);        fp3.setName("VPCI Color");        fp3.setDefault(Color.blue);    var fp3a = new FunctionParameter("cColor2", FunctionParameter.COLOR);        fp3a.setName("VPCI MA Color");        fp3a.setDefault(Color.grey);    var fp4 = new FunctionParameter("nThick", FunctionParameter.NUMBER);        fp4.setName("Thickness");        fp4.setLowerLimit(1);        fp4.setDefault(2);}// Global Variablesvar bVersion  = null;    // Version flagvar bInit     = false;   // Initialization flagvar xVPC = null;var xVPR = null;var xVM  = null;var xVPCI = null;var xVPCI_MA = null;function main(nLongP, nShortP, cColor, cColor2, nThick) {    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        //Initialization    if (bInit == false) {        setDefaultBarFgColor(cColor, 0);        setDefaultBarThickness(nThick, 0);        setDefaultBarFgColor(cColor2, 1);        setDefaultBarThickness(nThick, 1);        xVPC = efsInternal("calcVPC", nLongP);        xVPR = efsInternal("calcVPR", nShortP);        xVM  = efsInternal("calcVM",  nLongP, nShortP);        xVPCI  = efsInternal("calcVPCI",  nLongP, nShortP, xVPC, xVPR, xVM);        xVPCI_MA = efsInternal("calcVWMA", nShortP, xVPCI);        bInit = true;    }    var nState = getBarState();    var nVPCI = xVPCI.getValue(0);    var nVPCI_MA = xVPCI_MA.getValue(0);    if (nVPCI == null || nVPCI_MA == null) return;            return new Array(nVPCI, nVPCI_MA);}function calcVWMA(n, x) {    var nSum = 0;    var nTotVol = 0;        if (x.getValue(-n) == null) return;        for (var i = 0; i < n; i++) {        nSum += x.getValue(-i) * volume(-i);        nTotVol += volume(-i);    }        return (nSum / nTotVol);}function calcVPCI(nL, nS, xVPC, xVPR, xVM) {    var nState = getBarState();    var nVPC = xVPC.getValue(0);    var nVPR = xVPR.getValue(0);    var nVM  = xVM.getValue(0);    if (nVPC == null || nVPR == null || nVM == null) return;            return (nVPC * nVPR * nVM);}function calcVPC(n) {    var nVwma = vwma(n, 0);    var nSma  = sma(n, 0);    if (nVwma == null || nSma == null) return;        return (nVwma - nSma);}function calcVPR(n) {    var nVwma = vwma(n, 0);    var nSma  = sma(n, 0);    if (nVwma == null || nSma == null) return;        return (nVwma / nSma);}function calcVM(nL, nS) {    var nVolSma1 = sma(nL, volume(), 0);  // long term     var nVolSma2 = sma(nS, volume(), 0);  // short term    if (nVolSma1 == null || nVolSma2 == null) return;        return (nVolSma2 / nVolSma1);}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;}

VPCI_Bollinger.efs

/***************************************Provided By:     eSignal (Copyright ) eSignal), a division of Interactive Data     Corporation. 2007. All rights reserved. This sample eSignal     Formula Script (EFS) is for educational purposes only and may be     modified and saved under a new filename.  eSignal is not responsible    for the functionality once modified.  eSignal reserves the right     to modify and overwrite this EFS file with each new release.    Description:  Between Price And Volume              by Buff DormeierVersion 1.0  5/08/2007Notes:* July 2007 Issue of Stocks and Commodities Magazine* Study requires version 8.0 or later.Formula Parameters:                     Default:Long-term Period                        50Short-term Period                       10Bollinger Period                        10Bollinger Stdev                         2VPCI Color                              blueBollinger Band Color                    redThickness                               2***************************************/function preMain() {    setStudyTitle("VPCI with Bollinger Bands");    setShowTitleParameters(false);    setCursorLabelName("Upper BB", 0);    setCursorLabelName("Middle BB", 1);    setCursorLabelName("Lower BB", 2);    setCursorLabelName("VPCI", 3);    var fp1 = new FunctionParameter("nLongP", FunctionParameter.NUMBER);        fp1.setName("Long-term Period");        fp1.setLowerLimit(1);        fp1.setDefault(50);    var fp2 = new FunctionParameter("nShortP", FunctionParameter.NUMBER);        fp2.setName("Short-term Period");        fp2.setLowerLimit(1);        fp2.setDefault(10);    var fp2a = new FunctionParameter("nBBP", FunctionParameter.NUMBER);        fp2a.setName("Bollinger Period");        fp2a.setLowerLimit(1);        fp2a.setDefault(10);    var fp2b = new FunctionParameter("nStdev", FunctionParameter.NUMBER);        fp2b.setName("Bollinger Stdev");        fp2b.setLowerLimit(1);        fp2b.setDefault(2);    var fp3 = new FunctionParameter("cColor", FunctionParameter.COLOR);        fp3.setName("VPCI Color");        fp3.setDefault(Color.blue);    var fp3a = new FunctionParameter("cColor2", FunctionParameter.COLOR);        fp3a.setName("Bollinger Bands Color");        fp3a.setDefault(Color.red);    var fp4 = new FunctionParameter("nThick", FunctionParameter.NUMBER);        fp4.setName("Thickness");        fp4.setLowerLimit(1);        fp4.setDefault(2);}// Global Variablesvar bVersion  = null;    // Version flagvar bInit     = false;   // Initialization flagvar xVPC = null;var xVPR = null;var xVM  = null;var xVPCI = null;var xUpperBB = null;var xMiddleBB = null;var xLowerBB = null;function main(nLongP, nShortP, nBBP, nStdev, cColor, cColor2, nThick) {    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;        //Initialization    if (bInit == false) {        setDefaultBarFgColor(cColor2, 0);        setDefaultBarFgColor(cColor2, 1);        setDefaultBarFgColor(cColor2, 2);        setDefaultBarFgColor(cColor, 3);        setDefaultBarThickness(nThick, 0);        setDefaultBarThickness(nThick, 1);        setDefaultBarThickness(nThick, 2);        setDefaultBarThickness(nThick, 3);        xVPC = efsInternal("calcVPC", nLongP);        xVPR = efsInternal("calcVPR", nShortP);        xVM  = efsInternal("calcVM",  nLongP, nShortP);        xVPCI  = efsInternal("calcVPCI",  nLongP, nShortP, xVPC, xVPR, xVM);        xUpperBB = upperBB(nBBP, nStdev, sma(1, xVPCI));        xMiddleBB = middleBB(nBBP, nStdev, sma(1, xVPCI));        xLowerBB = lowerBB(nBBP, nStdev, sma(1, xVPCI));        bInit = true;    }        //return;    var nState = getBarState();    var nVPCI = xVPCI.getValue(0);    var nUpper = xUpperBB.getValue(0);    var nMiddle = xMiddleBB.getValue(0);    var nLower = xLowerBB.getValue(0);    if (nVPCI == null || nUpper == null || nMiddle == null || nLower == null) return;            return new Array(nUpper, nMiddle, nLower, nVPCI);}function calcVPCI(nL, nS, xVPC, xVPR, xVM) {    var nState = getBarState();    var nVPC = xVPC.getValue(0);    var nVPR = xVPR.getValue(0);    var nVM  = xVM.getValue(0);    if (nVPC == null || nVPR == null || nVM == null) return;            return (nVPC * nVPR * nVM);}function calcVPC(n) {    var nVwma = vwma(n, 0);    var nSma  = sma(n, 0);    if (nVwma == null || nSma == null) return;        return (nVwma - nSma);}function calcVPR(n) {    var nVwma = vwma(n, 0);    var nSma  = sma(n, 0);    if (nVwma == null || nSma == null) return;        return (nVwma / nSma);}function calcVM(nL, nS) {    var nVolSma1 = sma(nL, volume(), 0);  // long term     var nVolSma2 = sma(nS, volume(), 0);  // short term    if (nVolSma1 == null || nVolSma2 == null) return;        return (nVolSma2 / nVolSma1);}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;}