RSI Diff

ICE Data Services -

RSI_Diff.efs  
EFSLibrary - Discussion Board  

File Name: RSI_Diff.efs

Description:
RSI Diff

Formula Parameters:

  • Fast : 7
  • Slow : 14

Notes:
This is another indicator that plots the difference between 7-periods RSI and 14-periods RSI. This study may be useful in some approaches.

Download File:
RSI_Diff.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:        
    RSI Diff
    
Version:            1.0  04/29/2009
    
Formula Parameters:                     Default:
    Fast                                7
    Slow                                14
    
Notes:
    This is another indicator that plots the difference between 7-periods 
    RSI and 14-periods RSI. This study may be useful in some approaches. 
**********************************/
var fpArray = new Array();
var bInit = false;

function preMain() {
    setStudyTitle("RSI Oscillator"); 
    setCursorLabelName("RSI Oscillator",0);
    setDefaultBarFgColor(Color.red,0);
    addBand(0, PS_SOLID, 1, Color.black);
    var x = 0;
    fpArray[x] = new FunctionParameter("Fast", FunctionParameter.NUMBER);
    with(fpArray[x++]) {
        setLowerLimit(1);
        setDefault(7);
    }
    fpArray[x] = new FunctionParameter("Slow", FunctionParameter.NUMBER);
    with(fpArray[x++]) {
        setLowerLimit(1);
        setDefault(14);
    }   
}

var xRSI_Fast = null;
var xRSI_Slow = null;

function main(Fast, Slow) {
var nBarState = getBarState();
var nRSI_Fast = 0;
var nRSI_Slow = 0;
    if (nBarState == BARSTATE_ALLBARS) {
        if(Fast == null) Fast = 7;
        if(Slow == null) Slow = 14;
    }        
    if (bInit == false) {
        xRSI_Fast = rsi(Fast);
        xRSI_Slow = rsi(Slow);
        bInit = true;
    }
    nRSI_Fast = xRSI_Fast.getValue(0);
    nRSI_Slow = xRSI_Slow.getValue(0);
	if(nRSI_Fast == null || nRSI_Slow == null) return;
	return  nRSI_Fast - nRSI_Slow;
}