/*********************************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: TEMA1 Version: 1.0 09/24/2008Notes: This study plots the TEMA1 indicator. TEMA1 ia s triple MA (Moving Average), and is calculated as 3*MA - (3*MA(MA)) + (MA(MA(MA)))Formula Parameters: Default: Length 26 Price Data To Use Close**********************************/var fpArray = new Array();var bInit = false;function preMain() { setPriceStudy(true) setStudyTitle("TEMA"); setCursorLabelName("TEMA1", 0); setDefaultBarFgColor(Color.blue, 0); setPlotType(PLOTTYPE_LINE,0); setDefaultBarThickness(1,0); var x=0; fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(26); } fpArray[x] = new FunctionParameter("Price", FunctionParameter.STRING); with(fpArray[x++]){ setName("Price Data To Use"); addOption("open"); addOption("high"); addOption("low"); addOption("close"); addOption("hl2"); addOption("hlc3"); addOption("ohlc4"); setDefault("close"); }}var xMyPrice = null;var xEMA1 = null;var xEMA2 = null;var xEMA3 = null;function main(Price, Length) {var nState = getBarState();var nTEMA = 0; if (nState == BARSTATE_ALLBARS) { if (Price == null) Price = "close"; if (Length == null) Length = 26; } if ( bInit == false ) { xMyPrice = eval(Price)(); xEMA1 = ema(Length, xMyPrice); xEMA2 = ema(Length, xEMA1); xEMA3 = ema(Length, xEMA2); bInit = true; } if (xEMA1.getValue(0) == null || xEMA2.getValue(0) == null || xEMA3.getValue(0) == null) return; nTEMA = 3 * xEMA1.getValue(0) - 3 * xEMA2.getValue(0) + xEMA3.getValue(0); return nTEMA;} |