SHARE
TWEET

EOT Bgcolor

a guest Apr 18th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //By Glaz and LazyBear
  2. study(title="Ehlers Early Onset Trend",shorttitle="EOT")
  3. Period=input(20)
  4. Q1=input(0.8)
  5. Q2=input(0.4)
  6.  
  7. Quotient(LPPeriod, K)=>
  8.     PI = 3.1415926
  9.     angle = 0.707 * 2 * PI / 100
  10.     alpha1 = ( cos( angle ) + sin( angle ) - 1 ) / cos( angle )
  11.  
  12.     a1 = exp( -1.414 * PI / LPPeriod )
  13.     b1 = 2 * a1 * cos( 1.414 * PI / LPPeriod )
  14.     c2 = b1
  15.     c3 = -a1 * a1
  16.     c1 = 1 - c2 - c3
  17.  
  18.     HP= pow((1-alpha1/2),2)*(close - (2*close[1]) + close[2]) + 2*(1-alpha1)*nz(HP[1]) - pow((1-alpha1),2)* nz(HP[2])
  19.     Filt= c1 * (HP + nz(HP[1]))/2 + c2*nz(Filt[1]) + c3*nz(Filt[2])
  20.     Pk= iff(abs(Filt) >  0.991 *nz(Pk[1]), abs(Filt), 0.991 * nz(Pk[1]))
  21.     X = nz(Filt / Pk)
  22.    
  23.     q=( X + K ) / ( K * X + 1 )
  24.  
  25. plot(Quotient( Period, Q1 ),color=red)
  26. plot(Quotient( Period, Q2 ),color=aqua)
  27. hline(0)
  28.  
  29. red1 = Quotient(Period,Q1)
  30. aqua1 = Quotient(Period,Q2)
  31.  
  32. up = crossover(red1,0)
  33. down = crossunder(aqua1,0)
  34.  
  35. bgcolor(down?red:na,transp=50)
  36. bgcolor(up?green:na,transp=50)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top