File Name: SmoothedRSI.efs
Description:
Smoothed RSI
Formula Parameters:
Length : 10
Notes:
This is new version of RSI oscillator indicator, developed by John Ehlers.
The main advantage of his way of enhancing the RSI indicator is smoothing
with minimum of lag penalty.
Download File:
SmoothedRSI.efs
EFS Code:
Description:
Smoothed RSI
Formula Parameters:
Length : 10
Notes:
This is new version of RSI oscillator indicator, developed by John Ehlers.
The main advantage of his way of enhancing the RSI indicator is smoothing
with minimum of lag penalty.
Download File:
SmoothedRSI.efs
EFS Code:
PHP 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:
Smoothed RSI
Version: 1.0 05/04/2009
Formula Parameters: Default:
Length 10
Notes:
This is new version of RSI oscillator indicator, developed by John Ehlers.
The main advantage of his way of enhancing the RSI indicator is smoothing
with minimum of lag penalty.
**********************************/
var fpArray = new Array();
var bInit = false;
function preMain() {
setPriceStudy(false);
setStudyTitle("SRSI");
setCursorLabelName("SRSI", 0);
setDefaultBarFgColor(Color.blue, 0);
setStudyMax(1.1);
setStudyMin(-0.1);
var x = 0;
fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER);
with(fpArray[x++]) {
setLowerLimit(1);
setDefault(10);
}
}
Smooth23 = new Array();
var xSRSI = null;
function main(Length) {
var nBarState = getBarState();
var nSRSI = 0;
if (nBarState == BARSTATE_ALLBARS) {
if (Length == null) Length = 10;
}
if (bInit == false) {
xSRSI = efsInternal("Calc_SRSI", Length);
bInit = true;
}
nSRSI = xSRSI.getValue(0);
if (nSRSI == null) return;
return nSRSI;
}
var bSecondInit = false;
var xValue = null;
function Calc_SRSI(Length){
var nRes = 0;
var i = 0;
var CU23 = 0;
var CD23 = 0;
if (bSecondInit == false) {
xValue = efsInternal("Calc_Value");
bSecondInit = true;
}
if (xValue.getValue(-Length) == null) return;
for(i = 0; i < Length - 1; i++){
if(xValue.getValue(-i) > xValue.getValue(-(i + 1)))
CU23 += xValue.getValue(-i) - xValue.getValue(-(i + 1));
if(xValue.getValue(-i) < xValue.getValue(-(i + 1)))
CD23 += xValue.getValue(-(i + 1)) - xValue.getValue(-i);
}
if(CU23 + CD23 != 0)
nRes = CU23/(CU23 + CD23);
return nRes;
}
var xClose = null;
function Calc_Value() {
var nRes = 0;
if (xClose == null) xClose = close();
if (xClose.getValue(-3) == null) return;
nRes = (xClose.getValue(0) + 2 * xClose.getValue(-1) + 2 * xClose.getValue(-2) + xClose.getValue(-3) ) / 6
return nRes;
}