Black Friday great discounts start today Learn more
+1 888 340 6572

JRC_RSI_adapt

Article/Author: Mark Jurik, Jurik Research www.jurikres.com

Download: Rsi_simp.ela

File Includes: Function - JRC_RSI_adapt

Category: Function > JRC_RSI_adapt

Description:

Mark Jurik modified the basic RSI function (that comes with TradeStation Technology software) so that you can alter its length parameter on a bar-to-bar basis. This lets you create dynamically adjustable RSI signals. This flexible version of RSI is obviously more powerful than TradeStation's version.

NOTE: This calculates RSI exactly the samer way as the RSI function provided by Omega, with the exception that it was coded to compile as a type SIMPLE function.

With this version, you can make adaptive RSI indicators, such as the following....

-----------------------
value1 = your_formula_for_evaluating_RSI_length
value2 = JRC_RSI_adapt ( close, value1 ) ;
-----------------------

No tech support is provided by Jurik Research for this free indicator.

Inputs:

EasyLanguage Code:
INPUTS : PRICE(NUMERICSERIES),LENGTH(NUMERICSIMPLE);

VARS : COUNTER(0),DOWNAMT(0),UPAMT(0),UPSUM(0), DOWNSUM(0),MYRANGE(0), TEMP(0);
ARRAYS: UPAVG[1](0), DNAVG[1](0);

IF CURRENTBAR = 1 THEN BEGIN
UPSUM = 0;
DOWNSUM = 0;
FOR COUNTER = 0 TO LENGTH-1 BEGIN
UPAMT = PRICE[COUNTER] - PRICE[COUNTER+1];
IF (UPAMT >= 0) THEN DOWNAMT = 0
ELSE BEGIN
DOWNAMT = -UPAMT;
UPAMT = 0;
END;
UPSUM = UPSUM + UPAMT;
DOWNSUM = DOWNSUM + DOWNAMT;
END;
UPAVG[1] = UPSUM / LENGTH;
DNAVG[1] = DOWNSUM / LENGTH;
END

ELSE IF CURRENTBAR > 1 THEN BEGIN

UPAMT = PRICE[0] - PRICE[1];
IF UPAMT >= 0 THEN BEGIN
DOWNAMT = 0;
END
ELSE BEGIN
DOWNAMT = -UPAMT;
UPAMT = 0;
END;
UPAVG[1] = (UPAVG[1] * (LENGTH - 1) + UPAMT) / LENGTH;
DNAVG[1] = (DNAVG[1] * (LENGTH - 1) + DOWNAMT) / LENGTH;
END;

TEMP = UPAVG[1]+DNAVG[1] ;
JRC_RSI_ADAPT = IFF ( TEMP = 0 , 0 , 100 * UPAVG[1] / TEMP) ;