RSI Channel ob/os breakout or reversion

Category: Indicators By: Nicolas Created: March 1, 2019, 10:10 AM
March 1, 2019, 10:10 AM
Indicators
5 Comments

This indicator spot the touch/breakout/reversion of the price with its channel upper and lower bounds made from the reverse engineered version of RSI by our member Louis Winthorp III: RSI Reverse Engineering indicator

Once the price has touched one of the band a “cage” is plotted during “levelperiod” candlesticks to easily spot the breakout of the price in the same direction of the reverse to the mean of the price.

RSIperiod and AveragePeriod of the channel can be modified in the settings.

Original idea from this topic: breakout of RSI channel

//PRC_RSI Channel Ob/Os Breakout | indicator
//01.03.2019
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings 
AveragePeriod = 14
RSIperiod = 14
levelperiod = 20
// --- end of settings 

//////////////////////////////////////////////////
//_RSI_LEVELS_

ONCE RSI70 = UNDEFINED
ONCE RSI30 = UNDEFINED

RSIORI = RSI[RSIperiod](CLOSE)
UPORI = MAX(0,CLOSE-CLOSE[1])
DOWNORI = MAX(0,CLOSE[1]-CLOSE)
UPMAORI = WILDERAVERAGE[AveragePeriod](UPORI)
DOWNMAORI = WILDERAVERAGE[AveragePeriod](DOWNORI)

RSREV = (100/((-1*70)+100)) - 1

IF 70 < RSIORI THEN
 UPMAREV = UPMAORI * (1-(1/14))
 DOWNMAREV = UPMAREV / RSREV
 DOWNREV = (DOWNMAREV-(DOWNMAORI*(1-(1/14))))/(1/14)
 RSI70 = CLOSE - DOWNREV
ELSIF 70 > RSIORI THEN
 DOWNMAREV = DOWNMAORI * (1-(1/14))
 UPMAREV = DOWNMAREV * RSREV
 UPREV = (UPMAREV-(UPMAORI*(1-(1/14))))/(1/14)
 RSI70 = CLOSE + UPREV
ENDIF

RSI50 = WILDERAVERAGE[AveragePeriod](CLOSE)

RSIORI2 = RSI[RSIperiod](CLOSE)
UPORI2 = MAX(0,CLOSE-CLOSE[1])
DOWNORI2 = MAX(0,CLOSE[1]-CLOSE)
UPMAORI2 = WILDERAVERAGE[AveragePeriod](UPORI2)
DOWNMAORI2 = WILDERAVERAGE[AveragePeriod](DOWNORI2)

RSREV2 = (100/((-1*30)+100)) - 1

IF 30 < RSIORI2 THEN
 UPMAREV2 = UPMAORI2 * (1-(1/14))
 DOWNMAREV2 = UPMAREV2 / RSREV2
 DOWNREV2 = (DOWNMAREV2-(DOWNMAORI2*(1-(1/14))))/(1/14)
 RSI30 = CLOSE - DOWNREV2
ELSIF 30 > RSIORI2 THEN
 DOWNMAREV2 = DOWNMAORI2 * (1-(1/14))
 UPMAREV2 = DOWNMAREV2 * RSREV2
 UPREV2 = (UPMAREV2-(UPMAORI2*(1-(1/14))))/(1/14)
 RSI30 = CLOSE + UPREV2
ENDIF

//low break
if low crosses under RSI30 then
 lowstartbar=barindex
 lowstartlevel=rsi30
endif
if lowstartbar>0 and barindex-lowstartbar<=levelperiod then
 drawsegment(lowstartbar,lowstartlevel,barindex,lowstartlevel) coloured(255,0,0)
 drawbarchart(lowstartlevel,lowstartlevel,lowstartlevel,rsi30) coloured(160,160,160,150)
endif
if barindex-lowstartbar=levelperiod then
 drawsegment(barindex,lowstartlevel,barindex,RSI30) coloured(255,0,0)
endif
//high break
if high crosses over RSI70 then
 highstartbar=barindex
 highstartlevel=rsi70
endif
if highstartbar>0 and barindex-highstartbar<=levelperiod then
 drawsegment(highstartbar,highstartlevel,barindex,highstartlevel) coloured(0,255,0)
 drawbarchart(highstartlevel,highstartlevel,highstartlevel,rsi70) coloured(160,160,160,200)
endif
if barindex-highstartbar=levelperiod then
 drawsegment(barindex,highstartlevel,barindex,RSI70) coloured(0,255,0)
endif

RETURN RSI70 COLOURED (0,0,0) STYLE (LINE,3) AS "_DAILY_RSI_70%_", RSI50 COLOURED (153,0,153) STYLE (LINE,3) AS "_DAILY_RSI_50%_", RSI30 COLOURED (0,0,0) STYLE (LINE,3) AS "_DAILY_RSI_30%_"

 

 

 

Download
Filename: PRC_RSI-Channel-ObOs-Breakout.itf
Downloads: 340
Nicolas Master
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

Logo Logo
Loading...