Laguerre_RSI.efs
EFSLibrary - Discussion Board
File Name: Laguerre_RSI.efs
Description:
Laguerre-based RSI
Formula Parameters:
- gamma : 0.5
Notes:
This is RSI indicator which is more sesitive to price changes. It is based upon a modern math tool - Laguerre transform filter. With help of Laguerre filter one becomes able to create superior indicators using very short data lengths as well. The use of shorter data lengths means you can make the indicators more responsive to changes in the price.
Download File:
Laguerre_RSI.efs
EFS Code:
/********************************* 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: Laguerre-based RSI Version: 1.0 04/15/2009 Formula Parameters: Default: gamma 0.5 Notes: This is RSI indicator which is more sesitive to price changes. It is based upon a modern math tool - Laguerre transform filter. With help of Laguerre filter one becomes able to create superior indicators using very short data lengths as well. The use of shorter data lengths means you can make the indicators more responsive to changes in the price. **********************************/ var fpArray = new Array(); var bInit = false; function preMain() { setStudyTitle("Laguerre RSI"); setCursorLabelName("Laguerre RSI", 0); setDefaultBarFgColor(Color.red, 0); setDefaultBarThickness(2, 0); addBand(0.2, PS_SOLID, 1, Color.lightgrey); addBand(0.8, PS_SOLID, 1, Color.lightgrey); setStudyMax(1.1); setStudyMin(-0.1); var x = 0; fpArray[x] = new FunctionParameter("gamma", FunctionParameter.NUMBER); with(fpArray[x++]) { setUpperLimit(0.9); setLowerLimit(0.1); setDefault(0.5); } } var xRSI = null; function main(gamma) { var nBarState = getBarState(); var nRSI = 0; if (nBarState == BARSTATE_ALLBARS) { if(gamma == null) gamma = 0.5; } if (bInit == false) { xRSI = efsInternal("Calc_RSI", gamma); bInit = true; } nRSI = xRSI.getValue(0); if (nRSI == null) return; return nRSI; } var bSecondInit = false; var xL0 = null; var xL1 = null; var xL2 = null; var xL3 = null; function Calc_RSI(gamma) { var nRes = 0; var CU = 0; var CD = 0; if (bSecondInit == false) { xL0 = efsInternal("Calc_L0", gamma); xL1 = efsInternal("Calc_Values", gamma, xL0); xL2 = efsInternal("Calc_Values", gamma, xL1); xL3 = efsInternal("Calc_Values", gamma, xL2); bSecondInit = true; } var L0 = xL0.getValue(0); var L1 = xL1.getValue(0); var L2 = xL2.getValue(0); var L3 = xL3.getValue(0) if(L0 >= L1) CU = L0 - L1; else CD = L1 - L0; if(L1 >= L2) CU = CU + L1 - L2; else CD = CD + L2 - L1; if(L2 >= L3) CU = CU + L2 - L3 else CD = CD + L3 - L2; if(CU + CD != 0) nRes = CU / (CU + CD); if (nRes == null) return; return nRes; } function Calc_L0(gamma) { var nRes = 0; var nRef = ref(-1); if (nRef == null) nRef = 1; nRes = (1 - gamma) * close(0) + gamma * nRef; if (nRes == null) return; return nRes; } function Calc_Values(gamma, xSeries) { var nRes = 0; var nRef = ref(-1); if (nRef == null) nRef = 1; nRes = - gamma * xSeries.getValue(0) + xSeries.getValue(-1) + gamma * nRef; if (nRes == null) return; return nRes; }