RelativeVigorIndex.efs
File Name: RelativeVigorIndex.efs
Description:
The following study is based on the January 2002 article, Relative Vigor Index (RVI), by John Ehlers's.
Formula Parameters:
- Line Color RVI: Red
- Line Color Sig: Blue
- Line Thicknes: 2
- Display Cursor Labels: False
Notes:
The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com
Download File:
RelativeVigorIndex.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: Relative Vigor Index Version: 1.0 18/09/2008 Notes: The related article is copyrighted material. If you are not a subscriber of Stocks & Commodities, please visit www.traders.com. Formula Parameters: Default: Line Color RVI Red Line Color Sig Blue Line Thicknes 2 Display Cursor Labels False **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setPriceStudy(false); setShowCursorLabel(false); setShowTitleParameters( false ); setStudyTitle("Relative Vigor Index"); setCursorLabelName("RVI", 0); setCursorLabelName("Sig", 1); setDefaultBarFgColor(Color.red, 0); setDefaultBarFgColor(Color.blue, 1); setPlotType(PLOTTYPE_LINE, 0); setPlotType(PLOTTYPE_LINE, 1); setDefaultBarThickness(2, 0); setDefaultBarThickness(2, 1); askForInput(); var x=0; fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Line Color RVI"); setDefault(Color.red); } fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Line Color Sig"); setDefault(Color.blue); } fpArray[x] = new FunctionParameter("ViewValue", FunctionParameter.BOOLEAN); with(fpArray[x++]){ setName("Display Cursor Labels"); setDefault(false); } fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with(fpArray[x++]){ setLowerLimit(1); setDefault(10); } fpArray[x] = new FunctionParameter("Thickness", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Line Thickness"); setLowerLimit(1); setDefault(2); } } var xChange = null; var xMyRange = null; var xValue1First = null; var xValue2First = null; var xValue1Two = null; var xValue2Two = null; var xRVI = null; var xRVISig = null; var xNum = null; var xDen = null; function main(Length, Thickness, LineColor1, LineColor2, ViewValue) { var nLength1 = 0; var nLength2 = 0; var nRVI = 0; var nRVISig = 0; if ( bInit == false ) { setDefaultBarFgColor(LineColor1, 0); setDefaultBarFgColor(LineColor2, 1); setDefaultBarThickness(Thickness, 0); setDefaultBarThickness(Thickness, 1); setShowCursorLabel(ViewValue); xChange = efsInternal("Calc_Change"); xMyRange = efsInternal("Calc_MyRange"); nLength1 = Math.floor((4 + 1) * 0.5); nLength2 = Math.ceil((4 + 1) * 0.5); xValue1First = efsInternal("TriAverage_gen", xChange, nLength1); xValue2First = efsInternal("TriAverage_gen", xMyRange, nLength1); xValue1Two = efsInternal("TriAverage_gen", xValue1First, nLength2); xValue2Two = efsInternal("TriAverage_gen", xValue2First, nLength2); xNum = efsInternal("Summation", xValue1Two, Length ) ; xDen = efsInternal("Summation", xValue2Two, Length ) ; xRVI = efsInternal("Calc_RVI" , xNum , xDen); xRVISig = efsInternal("TriAverage_gen", xRVI, 4 ) ; bInit = true; } if (getCurrentBarCount() < Length) return; nRVI = xRVI.getValue(0); nRVISig = xRVISig.getValue(0); return new Array(nRVI, nRVISig); } function Calc_RVI(xNum, xDen){ var nRes = 0; if (xDen.getValue(0) > 0) { nRes = (xNum.getValue(0) / xDen.getValue(0)); return nRes; } return 0; } function Summation(xSeries, nLength){ var nRes = 0; for (var i = 0; i < nLength; i++) { nRes += xSeries.getValue(-i); } if (nRes == null) nRes = 1; return nRes; } function TriAverage_gen(xSeries, nLength){ var nRes = 0; for (var i = 0; i < nLength; i++) { nRes += xSeries.getValue(-i); } nRes = nRes / nLength; if (nRes == null) nRes = 1; return nRes; } function Calc_Change(){ var nRes = 0; nRes = close(0) - open(0); if (nRes == null) nRes = 1; return nRes; } function Calc_MyRange(){ var nRes = 0; nRes = high(0) - low(0); if (nRes == null) nRes = 1; return nRes; }