Ehlers Inverse Fisher Transform of RSI or RSX

Category: Indicators By: Nicolas Created: August 20, 2018, 8:57 AM
August 20, 2018, 8:57 AM
Indicators
5 Comments

Published in the Technical Analysis of Stocks and Commodities magazine in the May 2004 issue, the inverse fisher transform is an indicator created by John Ehlers. The Inverse Fisher Transform was developed to help traders and investors with their timing decisions to buy and sell securities. It does this by altering the probability distribution function (PDF) of any indicator and makes it appear smoother.

This version include the inverse fisher transform calculation method applied on the RSI (upper oscillator in the screenshot) or the RSX (lower oscillator in the attached picture).

Settings explained:

  • RsiPeriod: Period of RSI or RSX oscillator
  • RsiMethod: 0=RSI 1=RSX
  • SmoothPeriod: Smoothing period applied on the oscillator with a linear weighted average
  • MinMaxPeriod: period of highest high / lowest low to calculate the dynamic overbough/oversold levels
  • LevelUp: percentage of the overbought upper level
  • LevelDown: percentage of the oversold lower level
//PRC_InverseFisherTrans_RSI-RSX | indicator
//17.08.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings
RsiPeriod       = 10 // RSI period
RsiMethod       = 1 // Rsi method (0=RSI, 1=RSX)
SmoothPeriod    = 9 // Smoothing period
MinMaxPeriod    = 50 // Floating levels period (<= 1 for fixed levels)
LevelUp         = 80.0 // Up level %
LevelDown       = 20.0 // Down level %
// --- end of settings

RsiPrice        = customclose // Price
if barindex>RsiPeriod then
 smallRsiValue = 0.0000000000000001
 if RsiMethod=0 then
  //RSI
  alpha = 1.0/Max(RsiPeriod,1)
  change = RsiPrice-RsiPrice[1]
  workRsichange = workRsichange[1] + alpha*( change  - workRsichange[1])
  workRsichanga = workRsichanga[1] + alpha*(Abs(change) - workRsichanga[1])
  iRsi = (50.0*(workRsichange/Max(workRsichanga,smallRsiValue)+1))
 else
  //RSX
  Len=rsiperiod

  if (f90 = 0.0) then
   f90 = 1.0
   f0 = 0.0
   if (Len-1 >= 5) then
    f88 = Len-1.0
   else
    f88 = 5.0
   endif
   f8 = 100.0*(rsiprice)
   f18 = 3.0 / (Len + 2.0)
   f20 = 1.0 - f18
  else
   if (f88 <= f90) then
    f90 = f88 + 1
   else
    f90 = f90 + 1
   endif
   f10 = f8
   f8 = 100*Close
   v8 = f8 - f10
   f28 = f20 * f28 + f18 * v8
   f30 = f18 * f28 + f20 * f30
   vC = f28 * 1.5 - f30 * 0.5
   f38 = f20 * f38 + f18 * vC
   f40 = f18 * f38 + f20 * f40
   v10 = f38 * 1.5 - f40 * 0.5
   f48 = f20 * f48 + f18 * v10
   f50 = f18 * f48 + f20 * f50
   v14 = f48 * 1.5 - f50 * 0.5
   f58 = f20 * f58 + f18 * Abs(v8)
   f60 = f18 * f58 + f20 * f60
   v18 = f58 * 1.5 - f60 * 0.5
   f68 = f20 * f68 + f18 * v18

   f70 = f18 * f68 + f20 * f70
   v1C = f68 * 1.5 - f70 * 0.5
   f78 = f20 * f78 + f18 * v1C
   f80 = f18 * f78 + f20 * f80
   v20 = f78 * 1.5 - f80 * 0.5

   if ((f88 >= f90) and (f8 <> f10)) then
    f0 = 1.0
   endif
   if ((f88 = f90) and (f0 = 0.0)) then
    f90 = 0.0
   endif
  endif


  if ((f88 < f90) and (v20 > smallRsiValue)) then

   v4 = (v14 / v20 + 1.0) * 50.0
   if (v4 > 100.0) then
    v4 = 100.0
   endif
   if (v4 < 0.0) then
    v4 = 0.0
   endif
  else
   v4 = 50.0
  endif

  irsi=v4
 endif

 //linear weighted moving average
 sumw = smoothperiod
 sum  = smoothperiod*(0.1*(iRsi-50))
 workLwma = (0.1*(iRsi-50))
 for k=1 to smoothperiod-1 do
  weight = smoothperiod-k
  sumw  = sumw + weight
  sum   = sum+(weight*workLwma[k])
 next
 trss = (sum/sumw)

 //oscillator final cut
 e = 2.7182818284590452353602874713527
 y = exp((2.0*trss)*log(e))
 rsii=(y-1.0)/(y+1.0)

 //levels
 mmin = rsii
 mmax = rsii
 for k=1 to MinMaxPeriod-1 do
  mmin=min(rsii[k],mmin)
  mmax=max(rsii[k],mmax)
 next
 rrange = mmax-mmin
 levelupz = mmin+LevelUp * rrange/100
 leveldnz = mmin+LevelDown * rrange/100
 levelmi = mmin+0.5*rrange

 //Color
 r=100
 g=100
 b=100
 if rsii>levelupz then
  r=50
  g=205
  b=50
 elsif rsii<leveldnz then
  r=255
  g=165
  b=0
 endif
endif

return levelupz coloured(50,205,50) style(dottedline,2) as "Level Up", leveldnz coloured(255,165,0) style(dottedline,2) as "Level Down", levelmi coloured(155,155,155) style(dottedline,2) as "mid level", rsii coloured(r,g,b) style(line,2) as "RSI"

 

Download
Filename: PRC_InverseFisherTrans_RSI-RSX.itf
Downloads: 247
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...