// Downloaded From https://www.WiseStockTrader.com /********************************* 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: Acceleration & Speed Version: 1.0 09/25/2009 Formula Parameters: Default: Length 24 sPrice Close Notes: **********************************/ var fpArray = new Array(); var bInit = false; function preMain(){ setPriceStudy(false); setShowCursorLabel(true); setShowTitleParameters(false); setStudyTitle("Acceleration & Speed"); setCursorLabelName("Speed", 0); setPlotType(PLOTTYPE_LINE, 0); setDefaultBarFgColor(Color.red, 0); setCursorLabelName("Acceleration", 1); setPlotType(PLOTTYPE_LINE, 1); setDefaultBarFgColor(Color.green, 1); var x = 0; fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]) { setLowerLimit(1); setDefault(24); } fpArray[x] = new FunctionParameter("sPrice", FunctionParameter.STRING); with(fpArray[x++]){ setName("Source of Price"); addOption("open"); addOption("high"); addOption("low"); addOption("close"); addOption("hl2"); addOption("hlc3"); addOption("ohlc4"); setDefault("close"); } } var xSpeed = null; var xAcceleration = null; function main(Length, sPrice) { var nBarState = getBarState(); var nSpeed = 0; var nAcceleration = 0; if (nBarState == BARSTATE_ALLBARS) { if(Length == null) Length = 2; if(sPrice == null) sPrice = "close"; } if (bInit == false) { xSpeed = mom(Length, eval(sPrice)()); xAcceleration = mom(Length, xSpeed); bInit = true; } nSpeed = xSpeed.getValue(0); nAcceleration = xAcceleration.getValue(0); if (nAcceleration == null) return; return new Array(nSpeed, nAcceleration); }