LazyBear

Ehlers Smoothed Stochastic & RSI with Roofing Filters

Roofing filters, first discussed by Mr.John Ehlers , act as a passband, filtering out unwanted noise from market data and accentuating turning points.

I have included 2 indicators with filters enabled. Both support double smoothing via options page. All the parameters are configurable.

Info on Roofing Filter and Ehlers Super Smoother:
----------------------------------------------------
The Ehlers' Roofing Filter is an expansion on Ehlers Super Smoother Filter, both being smoothing techniques based on analog filters. This filter aims at reducing noise in price data.

In Super Smoother Filter, regardless of the time frame used, all waves having cycles of less than 10 bars are considered noise (customizable via options page). The Roofing Filter uses this principle, however, it also creates a so-called "roof" by eliminating wave components having cycles greater than 48 bars which are perceived as "spectral dilation". Thus, the filter only passes those spectral components whose periods are between 10 and 48 bars. This technique noticeably reduces indicator lag and also helps assess turning points more accurately.

More info:
- Spectral dilation paper: http://www.mesasoftware.com/Seminars/Spe...
- John Ehlers presentation: http://www.youtube.com/watch?v=BR5pDiPYs...

------------------------------------------------------
If you want to use RSI %B and Bandwidth, follow this guide to "Make mine" this chart and get access to the source:
https://drive.google.com/file/d/0Bx48Du_...

For the complete list of my indicators, check this post:
Rimuovi dagli script preferiti Aggiungi agli script preferiti
//
// @author LazyBear 
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study("Ehlers Smoothed Stochastic [LazyBear]", shorttitle="ESSTOCH_LB")
PI=3.14159265359
applyDoubleSmoothing=input(false, type=bool)
length = input (14, title="Stoch Length")
lengthMA=input (3, title="Stoch MA Length")
over_bought = input (.8)
over_sold = input (.2)
src=close
roofingBandUpper=input(48)
roofingBandLower=input(10)

EhlersSuperSmootherFilter(price, lower) =>
	a1 = exp(-PI * sqrt(2) / lower)
	coeff2 = 2 * a1 * cos(sqrt(2) * PI / lower)
	coeff3 = - pow(a1,2)
	coeff1 = 1 - coeff2 - coeff3
	filt = coeff1 * (price + nz(price[1])) / 2 + coeff2 * nz(filt[1]) + coeff3 * nz(filt[2]) 
	filt

EhlersRoofingFilter(price, smoothed, upper, lower) =>  
	alpha1 = (cos(sqrt(2) * PI / upper) + sin (sqrt(2) * PI / upper) - 1) / cos(sqrt(2) * PI / upper)
	highpass = pow(1 - alpha1 / 2, 2) * (price - 2 * nz(price[1]) + nz(price[2])) + 
 	            2 * (1 - alpha1) * nz(highpass[1]) - pow(1 - alpha1, 2) * nz(highpass[2])
	smoothed ? EhlersSuperSmootherFilter(highpass, lower) : highpass
    
EhlersStochastic(price, length, applyEhlerSmoothing, roofingBandUpper, roofingBandLower) =>
	filt = EhlersRoofingFilter(price, applyEhlerSmoothing, roofingBandUpper, roofingBandLower)
	highestP = highest(filt, length)
	lowestP = lowest(filt, length)
	iff ((highestP - lowestP) != 0, (filt - lowestP) / (highestP - lowestP),  0)


stoch=EhlersSuperSmootherFilter(EhlersStochastic(src, length, applyDoubleSmoothing, roofingBandUpper, roofingBandLower), roofingBandLower)
hline (over_bought)
hline (over_sold)
hline((over_bought+over_sold)/2)
plot(sma(stoch, lengthMA), color=red, linewidth=1)
plot(stoch, color=blue, linewidth=1)

 
List of my free indicators: http://bit.ly/1LQaPK8
List of my indicators at Appstore: http://blog.tradingview.com/?p=970

Commenti

i cant seem to get the RSI to load on my charts and the script seems to only have the stoch ?
+9 Rispondi
This indicator is in PineScipt V3 can any one convert it to V4.

i get error on these two lines: -

filt = coeff1 * (price + nz(price)) / 2 + coeff2 * nz(filt) + coeff3 * nz(filt)
filt

highpass = pow(1 - alpha1 / 2, 2) * (price - 2 * nz(price) + nz(price)) +
2 * (1 - alpha1) * nz(highpass) - pow(1 - alpha1, 2) * nz(highpass)
+1 Rispondi
InSilico shri9891
@shri9891,

float filt = 0
filt := coeff1 * (price + nz(price)) / 2 + coeff2 * nz(filt) + coeff3 * nz(filt)
filt

float highpass = 0
highpass := pow(1 - alpha1 / 2, 2) * (price - 2 * nz(price) + nz(price)) +
2 * (1 - alpha1) * nz(highpass) - pow(1 - alpha1, 2) * nz(highpass)
+1 Rispondi
shri9891 InSilico
@InSilico,

Thanks man!!
Rispondi
RSI WITH Roofing Filter to be provide please
Rispondi
Hi LB really appreciate the free scripts, I can’t seem to be able to find the ehlers rsi. I’ve followed the link and don’t seem to be able to copy the indicator using the instructions on the linked page. Cheers.
Rispondi
Выложите пожалуйста индикатор RSI with Roofing Filters, его нигде нет.
Спасибо!)
Rispondi
Hello

Could someone recommend someone who can code this indicators for Ninjatrader 8 ?

Thanks
Rispondi
The second function

alpha1 = (cos(sqrt(2) * PI / upper) + sin (sqrt(2) * PI / upper) - 1) / cos(sqrt(2) * PI / upper)

should be

alpha1 = (cos(sqrt(2) * PI / (2 * upper)) + sin (sqrt(2) * PI / (2 * upper)) - 1) / cos(sqrt(2) * PI / (2 * upper))

Ehlers used 0.707 in his calculations for the spectral dilation ( = sqrt(2) / 2) so you are missing a '/2' somewhere in the multiplication chain of each trig function argument.
Rispondi
In the first function:

coeff2 = 2 * a1 * cos(sqrt(2) * PI / lower)

should be

coeff2 = 2 * a1 * cos(sqrt(2) * PI / l(2 * lower))

Ehlers multiplied by 180 degrees in his formula (PI / 2), but pine uses radians so everything else is correct.
Rispondi
Home Screener azioni Screener forex Screener cripto Calendario economico Come funziona Caratteristiche Grafico Costi Invita un amico Regolamento Centro di supporto Soluzioni per broker & siti web Widget Librerie grafiche Libreria grafica leggera Blog & Novità Twitter
Profilo Impostazioni profilo Account e fatturazione Amici invitati Coin I miei ticket di supporto Centro di supporto Idee pubblicate Follower Seguiti Messaggi Privati Chat Esci