GetRSIStudy

ICE Data Services -

GetRSIStudy() Advanced GET Study Functions

Creates object, which allows to get values of indicator Advanced GET Relative Strength Index in EFS scripts. The Advansed GET RSI returns three lines, the RSI and two moving averages of the RSI. The RSI is calculated by finding the percentage of positive closes (the current close is higher than the previous close) to negative closes (the current close is lower than the previous close).

Syntax
GetRSIStudy( nLength , PriceSource , nMavg1 , bExp1 , nMavg2 , bExp2 )

Parameters
Parameter: Description: Default:
nLength Number of periods to use for calculation of RSI.

 

n/a
PriceSource String. One of the following values: "Open", "High", "Low", "Close", "HL/2", "HLC/3", "OHLC/4", "Volume".

 

n/a
nMavg1 Number of periods to use for calculation of the first Moving Average.

 

n/a
bExp1 If this parameter is True the first MA is calculated as exponential, if False - as simple.

 

n/a
nMavg2 Number of periods to use for calculation of the second Moving Average.

 

n/a
bExp2 If this parameter is True the second MA is calculated as exponential, if False - as simple.

 

n/a

Member(s)
Syntax: Returned value:
GetRSIStudy.RSI Returns the value of RSI

 

GetOscStudy.MAVG1 Returns the value of the first Moving Average

 

GetOscStudy.MAVG2 Returns the value of the second Moving Average

 


Notes
Only available in versions 7.9 or later.

Code Example
Advanced GET RSI Indicator:
var fpArray = new Array();function preMain(){    askForInput();     setDefaultBarFgColor(Color.blue,0);    setDefaultBarFgColor(Color.red,1);    setDefaultBarFgColor(Color.lime,2);        setStudyTitle("AGET RSI");    setCursorLabelName("RSI",0);    setCursorLabelName("RSI MA1",1);    setCursorLabelName("RSI MA2",2);        var x=0;    fpArray[x] = new FunctionParameter("nLength", FunctionParameter.NUMBER);    with(fpArray[x++])    {        setName("Length");        setLowerLimit(1);        setDefault(14);    }    fpArray[x] = new FunctionParameter("PriceSource", FunctionParameter.STRING);    with(fpArray[x++])	{        addOption("Open");         addOption("High");        addOption("Low");        addOption("Close");        addOption("HL/2");        addOption("HLC/3");        addOption("OHLC/4");         setDefault("Close");     }        fpArray[x] = new FunctionParameter("nMavg1", FunctionParameter.NUMBER);    with(fpArray[x++])    {        setName("MAvg1");        setLowerLimit(1);        setDefault(7);    }    fpArray[x] = new FunctionParameter("bExp1", FunctionParameter.BOOLEAN);    with(fpArray[x++])    {            setName("Exp1");        setDefault(false);    }    fpArray[x] = new FunctionParameter("nMavg2", FunctionParameter.NUMBER);    with(fpArray[x++])    {            setName("MAvg2");        setLowerLimit(1);        setDefault(3);    }    fpArray[x] = new FunctionParameter("bExp2", FunctionParameter.BOOLEAN);    with(fpArray[x++])    {            setName("Exp2");        setDefault(false);    }}var vMA = null;function main( nLength, PriceSource, nMavg1, bExp1, nMavg2, bExp2 ) {    if (vMA == null) vMA = new GetRSIStudy(nLength, PriceSource, nMavg1, bExp1, nMavg2, bExp2);    return new Array(            vMA.getValue(GetRSIStudy.RSI),             vMA.getValue(GetRSIStudy.MAVG1),                         vMA.getValue(GetRSIStudy.MAVG2)            );}


See Also
Advanced GET Studies