2017 April: Volume-Weighted Moving Average by Ken Calhoun
File Name: VWMA_Breakouts.efs
Description:
Volume-Weighted Moving Average by Ken Calhoun
Formula Parameters:
VWMA_Breakouts.efs
- SMA Length: 70
- WVMA Length: 50
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
VWMA_Breakouts.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2016. 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: Volume-Weighted Moving Average by Ken Calhoun Version: 1.00 02/10/2017 Formula Parameters: Default: SMA Length 70 WVMA Length 50 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(); function preMain(){ setPriceStudy(true); setDefaultBarFgColor(Color.RGB(255,106,0),1); setCursorLabelName("SMA", 0); setCursorLabelName("VWMA", 1); var x=0; fpArray[x] = new FunctionParameter("SMALength", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setUpperLimit(1000); setDefault(70); setName("SMA Length"); } fpArray[x] = new FunctionParameter("VWMALength", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setUpperLimit(1000); setDefault(50); setName("VWMA Length"); } } var bInit = false; var bVersion = null; var bIsLong = false; var bWasLong = false; var xSMA = null; var xVWMA = null; function main(SMALength, VWMALength){ if (bVersion == null) bVersion = verify(); if (bVersion == false) return; if (getBarState() == BARSTATE_ALLBARS){ bInit = false; } if (!bInit){ bIsLong = false; bWasLong = false; xSMA = sma(SMALength); xVWMA = vwma(VWMALength); bInit = true; } if (xSMA.getValue(-1) == null || xVWMA.getValue(-1) == null) return; var nSMA = xSMA.getValue(0); var nSMA_1 = xSMA.getValue(-1); var nVWMA = xVWMA.getValue(0); var nVWMA_1 = xVWMA.getValue(-1); if (nSMA > nVWMA && bIsLong){ if (nSMA_1 <= nVWMA_1){ drawTextRelative(0, AboveBar1, "\u00EA", Color.red, null, Text.PRESET|Text.CENTER, "Wingdings", 10, "Exit"+rawtime(0)); drawText("Suggested Long Exit",BottomRow1,Color.red,Text.LEFT,"TextExit"+rawtime(0)); bIsLong = false; } else { removeText("Long"+rawtime(0)); removeText("Text"+rawtime(0)); } bIsLong = false; } if (!bIsLong && nSMA < nVWMA){ if (nSMA_1 > nVWMA_1){ drawTextRelative(0,BelowBar1, "\u00E9", Color.green, null, Text.PRESET|Text.CENTER, "Wingdings", 10, "Long"+rawtime(0)); drawText("Suggested Long Entry",TopRow1,Color.green,Text.LEFT,"Text"+rawtime(0)); bIsLong = true; bWasLong = true; } else { removeText("Exit"+rawtime(0)); removeText("TextExit"+rawtime(0)); if (bWasLong) bIsLong = true; } } return [nSMA, nVWMA]; } function verify(){ var b = false; if (getBuildNumber() < 779){ drawTextAbsolute(5, 35, "This study requires version 10.6 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; }