TrendIntensityIndex.efs
File Name: TrendIntensityIndex.efs
Description:
Trend Intensity Index
Formula Parameters:
- AvgLength: 60
- DevCalcLength: 30
- Thickness: 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:
TrendIntensityIndex.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: Trend Intensity Index Version: 1.0 01/12/2009 Formula Parameters: Default: AvgLength 60 DevCalcLength 30 Thickness 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("Trend Intensity Index "); setCursorLabelName("TII", 0); setCursorLabelName("Level Buy", 1); setCursorLabelName("Level Sell", 2); setDefaultBarFgColor(Color.green, 0); setDefaultBarFgColor(Color.blue, 1); setDefaultBarFgColor(Color.blue, 1); setPlotType(PLOTTYPE_LINE, 0); setPlotType(PLOTTYPE_LINE, 1); setPlotType(PLOTTYPE_LINE, 2); setDefaultBarThickness(2, 0); setDefaultBarThickness(2, 1); setDefaultBarThickness(2, 2); 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("AvgLength", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(60); } fpArray[x] = new FunctionParameter("DevCalcLength", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(30); } fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Line Thickness"); setLowerLimit(1); setDefault(2); } } var xAverage = null; function main(AvgLength, DevCalcLength, Thickness, LineColor, ViewValue) { var nSDPlus = 0; var nSDMinus = 0; var nDev = 0; var nOffset = 0; var nAvg = 0; var nTII = 0; if ( bInit == false ) { setDefaultBarFgColor(LineColor, 0); setDefaultBarThickness(Thickness, 0); setDefaultBarThickness(Thickness, 1); setDefaultBarThickness(Thickness, 2); setShowCursorLabel(ViewValue); xAverage = sma(AvgLength); bInit = true; } if (getCurrentBarCount() < AvgLength) return; nAvg = xAverage.getValue(0); nSDPlus = 0 ; nSDMinus = 0 ; for (nOffset = 0; nOffset < DevCalcLength - 1; nOffset++) { nDev = close(-nOffset) - nAvg ; if (nDev > 0) nSDPlus = nSDPlus + nDev; else nSDMinus = nSDMinus - nDev ; } nTII = nSDPlus / ( nSDPlus + nSDMinus ) * 100 ; if (nTII == null) return; return new Array(nTII, 80, 20); }