EhlersFilter.efs
File Name: EhlersFilter.efs
Description:
Ehlers Filter
Formula Parameters:
- Length : 15
- Thickness line : 2
- Line Color : Green
- Display Cursor Labels : True
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com.
Download File:
EhlersFilter.efs
EFS Code:
/********************************* Provided By: eSignal (Copyright c eSignal), a division of Interactive Data Corporation. 2008. 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: Ehlers Filter Version: 1.0 01/16/2009 Formula Parameters: Default: Length 15 Thickness line 2 Line Color Green Display Cursor Labels True 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; function preMain() { setPriceStudy(false); setShowCursorLabel(false); setShowTitleParameters( false ); setStudyTitle("Ehlers Filter"); setCursorLabelName("Ehlers", 0); setDefaultBarFgColor(Color.green, 0); setPlotType(PLOTTYPE_LINE, 0); setDefaultBarThickness(2, 0); askForInput(); var x=0; fpArray[x] = new FunctionParameter("LineColor", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Line Color"); setDefault(Color.green); } fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN); with(fpArray[x++]){ setName("Display Cursor Labels"); setDefault(true); } fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(15); } fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Line Thickness"); setLowerLimit(1); setDefault(2); } } var xCoef = null; var xPrice = null; function main(Length, Thickness, LineColor, ViewValue) { var nNum = 0; var nSumCoef = 0; var nCount = 0; var nFilt = 0; if ( bInit == false ) { setDefaultBarFgColor(LineColor, 0); setDefaultBarThickness(Thickness, 0); setShowCursorLabel(ViewValue); xPrice = hl2(); xCoef = efsInternal("Calc_Coef", xPrice) bInit = true; } for (nCount = 0; nCount < Length; nCount++) { nNum += xCoef.getValue(-nCount) * xPrice.getValue(-nCount); nSumCoef += xCoef.getValue(-nCount); } if (nSumCoef != 0) { nFilt = nNum / nSumCoef; } return nFilt; } function Calc_Coef(xPrice) { var nRes = 0; nPrice = 0; nPrice = xPrice.getValue(-5); if (nPrice == null) nPrice = 0; nRes = Math.abs(xPrice.getValue(0) - nPrice); return nRes; }