2009 Oct: Volume Weighted MACD Histogram, by David Hawkins

ICE Data Services -


VolWeighted_MacdHist.efs, VolWeighted_EMA.efs  EFSLibrary - Discussion Board
  

File Name: VolWeighted_MacdHist.efs, VolWeighted_EMA.efs


Description:
VolWeighted_MacdHist.efs
Volume Weighted MACD Histogram, by David Hawkins

VolWeighted_EMA.efs
Combining Exponential And Volume Weighting, by David Hawkins


Formula Parameters:
VolWeighted_MacdHist.efs
Long Period : 26
Short Period : 12
Smoothing Period : 9

VolWeighted_EMA.efs
Length : 22

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

Download File:
VolWeighted_MacdHist.efs
VolWeighted_EMA.efs





EFS Code:




/*********************************Provided By:      eSignal (Copyright c eSignal), a division of Interactive Data     Corporation. 2009. All rights reserved. This sample eSignal     Formula Script (EFS) is for educational purposes only and may be     modified and saved under a new file name.  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:           The Volume-Weighted MACD HistogramVersion:            1.0  07/07/2009Formula Parameters:                     Default:    Long Period                         26      Short Period                        12    Smoothing Period                    9    Notes:    The related article is copyrighted material. If you are not a subscriber    of Stocks & Commodities, please visit www.traders.com.**********************************/var fpArray = new Array();var bInit = false;var bVersion = null;function preMain() {    setPriceStudy(false);    setShowCursorLabel(true);    setShowTitleParameters(false);    setStudyTitle("VMACDH");    setPlotType(PLOTTYPE_HISTOGRAM);    setDefaultBarThickness(2, 0);    setDefaultBarFgColor(Color.green, 0);    setCursorLabelName("VMACDH", 0);         addBand(0, PS_SOLID, 1, Color.darkgrey);        askForInput();    var x=0;    fpArray[x] = new FunctionParameter("Short_period", FunctionParameter.NUMBER);	with(fpArray[x++]){        setName("Short Period");        setLowerLimit(1);		        setUpperLimit(500);		                setDefault(12);    }    fpArray[x] = new FunctionParameter("Long_period", FunctionParameter.NUMBER);	with(fpArray[x++]){        setName("Long Period");        setLowerLimit(1);		        setUpperLimit(501);		                setDefault(26);    }    fpArray[x] = new FunctionParameter("Smoothing_period", FunctionParameter.NUMBER);	with(fpArray[x++]){        setName("Smoothing Period");        setLowerLimit(1);		        setUpperLimit(200);		                setDefault(9);    }}var xVMACD = null;var xVMACDSignal = null;function main(Long_period, Short_period, Smoothing_period) {var nBarState = getBarState();var nRes = 0;var nVMACD = 0;var nVMACDSignal = 0;    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;       if (nBarState == BARSTATE_ALLBARS) {        if (Long_period == null) Long_period = 26;        if (Short_period == null) Short_period = 12;        if (Smoothing_period == null) Smoothing_period = 9;            }        if (!bInit) {         xVMACD =  efsInternal("Calc_VMACD", Long_period, Short_period);        xVMACDSignal =  ema(Smoothing_period, xVMACD);        bInit = true;     }    nVMACD = xVMACD.getValue(0);    nVMACDSignal = xVMACDSignal.getValue(0);    if (nVMACD == null || nVMACDSignal == null) return;    nRes = nVMACD - nVMACDSignal;    return nVMACD;}var bSecondInit = false;var xLongMA = null;var xShortMA = null;function Calc_VMACD(Long_period, Short_period) {var nRes = 0;var nShortMA = 0;var nLongMA = 0;    if (!bSecondInit) {        xLongMA = efsInternal("Calc_VWEMA", Long_period);        xShortMA = efsInternal("Calc_VWEMA", Short_period);        bSecondInit = true;    }    nLongMA = xLongMA.getValue(0);    nShortMA = xShortMA.getValue(0);    if (nLongMA == null || nShortMA == null) return;    nRes = nShortMA - nLongMA;    return nRes;}var bThridInit = false;var xMAVolPrice = null;var xMAVol = null;function Calc_VWEMA(Length) {var nRes = 0;var nMAVolPrice = 0;var nMAVol = 0;    if (!bThridInit) {        xMAVolPrice = ema(Length, efsInternal("CalcVolPrice"));        xMAVol = ema(Length, volume());        bThridInit = true;    }    nMAVolPrice = xMAVolPrice.getValue(0) * Length;    nMAVol = xMAVol.getValue(0) * Length;    if (nMAVolPrice == null || nMAVol == null || nMAVol == 0) return;    nRes = nMAVolPrice / nMAVol;    return nRes;}function CalcVolPrice() {var nRes = 0;    nRes = volume(0) * close(0);    return nRes;}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;}
/*********************************Provided By:      eSignal (Copyright c eSignal), a division of Interactive Data     Corporation. 2009. All rights reserved. This sample eSignal     Formula Script (EFS) is for educational purposes only and may be     modified and saved under a new file name.  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:            Combining Exponential And Volume WeightingVersion:            1.0  07/07/2009Formula Parameters:                     Default:    Length                              22    Notes:    The related article is copyrighted material. If you are not a subscriber    of Stocks & Commodities, please visit www.traders.com.**********************************/var fpArray = new Array();var bInit = false;var bVersion = null;function preMain() {    setPriceStudy(true);    setShowCursorLabel(true);    setShowTitleParameters(false);    setStudyTitle("VWEMA");    setPlotType(PLOTTYPE_LINE);    setDefaultBarThickness(2, 0);    setDefaultBarFgColor(Color.green, 0);    setCursorLabelName("VWEMA", 0);         askForInput();    var x=0;    fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);	with(fpArray[x++]){        setName("Length");        setLowerLimit(1);		        setUpperLimit(500);		                setDefault(22);    }}var xVWEMA = null;function main(Length) {var nBarState = getBarState();var nVWEMA = 0;    if (bVersion == null) bVersion = verify();    if (bVersion == false) return;       if (nBarState == BARSTATE_ALLBARS) {        if (Length == null) Length = 22;    }        if (!bInit) {         xVWEMA =  efsInternal("Calc_VWEMA", Length);        bInit = true;     }    nVWEMA = xVWEMA.getValue(0);    if (nVWEMA == null) return;    return nVWEMA;}var bSecondInit = false;var xMAVolPrice = null;var xMAVol = null;function Calc_VWEMA(Length) {var nRes = 0;var nMAVolPrice = 0;var nMAVol = 0;    if (!bSecondInit) {        xMAVolPrice = ema(Length, efsInternal("CalcVolPrice"));        xMAVol = ema(Length, volume());        bSecondInit = true;    }    nMAVolPrice = xMAVolPrice.getValue(0);    nMAVol = xMAVol.getValue(0);    if (nMAVolPrice == null || nMAVol == null || nMAVol == 0) return;    nRes = nMAVolPrice / nMAVol;    return nRes;}function CalcVolPrice() {var nRes = 0;    nRes = volume(0) * close(0);    return nRes;}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;}