Premium Stochastic Oscillator (PSO)

Category: Indicators By: Nicolas Created: October 2, 2018, 3:39 PM
October 2, 2018, 3:39 PM
Indicators
7 Comments

The PSO is a rewired version of a short-period stochastic. Unlike a standard stochastic oscillator, this indicator is normalized to register neutral values at zero while providing greater sensitivity to short-term price moves. This indicator uses a central zero line as a reference point and will oscillate above and below this point as price fluctuates. In addition, the PSO is smoothed by using a double exponential moving average to provide a more even response to turns in the market.

(from TASC magazine, August 2008 issue).

The Premium Stochastic Oscillator was introduced by technical analyst Lee Leibfarth.

 

//PRC_Premium Stochastic | indicator
//02.10.2018
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge
//converted from MT5 version

// --- settings
inpPeriod       =  32  // Stochastic period
inpSmoothPeriod =   5  // Smoothing period
inpLevel1       = 0.9  // Level 1
inpLevel2       = 0.2  // Level 2
// --- end of settings

if barindex>inpPeriod then
 alpha    = 2.0/(1.0+inpSmoothPeriod)
 minLevel = Min(inpLevel1,inpLevel2)
 maxLevel = Max(inpLevel1,inpLevel2)

 mini   = Lowest[inpPeriod](low)//low [ArrayMinimum(low ,_start,inpPeriod)];
 maxi   = Highest[inpPeriod](high)//high[ArrayMaximum(high,_start,inpPeriod)]

 sto   = 10.0*((close-mini)/(maxi-mini)-0.5)

 ema0 = ema0[1]+alpha*(sto-ema0[1])
 ema1 = ema1[1]+alpha*(ema0-ema1[1])

 iexp = Exp(ema1)
 val  = (iexp-1.0)/(iexp+1.0)

 //final cut
 r=169
 g=169
 b=169
 if val>-maxlevel and val<-minlevel then
  r=244
  g=164
  b=96
 endif
 if val<-maxlevel then
  r=255
  g=0
  b=0
 endif
 if val>minlevel then
  r=50
  g=205
  b=50
 endif
 if val>maxlevel then
  r=0
  g=100
  b=0
 endif

endif

return val coloured(r,g,b) style(line,3), 0 coloured(168,168,168) style(dottedline,1),inpLevel1 coloured(168,168,168) style(dottedline,1),-inpLevel1 coloured(168,168,168) style(dottedline,1),inpLevel2 coloured(168,168,168) style(dottedline,1),-inpLevel2 coloured(168,168,168) style(dottedline,1)

 

Download
Filename: PRC_Premium-Stochastic.itf
Downloads: 286
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...