Madrid Sinewave

4260 7
This implements the Even Better Sinewave indicator as described in the book Cycle Analysis for Traders by John F. Ehlers.
In the example I used 36 as the cycle to be analyzed and a second cycle with a shorter period, 9, the larger period tells where the dominant cycle is heading, and the faster cycle signals entry/exit points and reversals.
从常用的脚本中删除 添加到常用的脚本
// Madrid : 09/Jun/2015 21:09 : Even Better Sinewave : 1.0
// This implements the Even Better Sinewave indicator 
// Ref. Cycle Analysis for Traders by John F. Ehlers.

study("Madrid Sinewave", shorttitle="MSineWave")
Duration = input(36)
src = close

OB = 0.85, OS = -0.85
PI = 3.14159265358979

deg2rad( deg ) =>

lowerBand = input(9)
ssFilter( price, lowerBand ) =>
    angle = sqrt(2)*PI/lowerBand
    a1= exp(-angle)
    b1 = 2*a1*cos(angle)
    c2 = b1
    c3 = -a1*a1
    c1 = 1 - c2 -c3
    filt = c1*(price + nz(price[1]))/2 + c2*nz(filt[1]) + c3*nz(filt[2])

// HighPass filter cyclic components whose periods are shorter than Duration input
x = src
angle = deg2rad(360)/Duration
alpha1 = ( 1-sin(angle) ) / cos(angle)
HP = 0.5*(1+alpha1)*(x-x[1]) + alpha1*nz(HP[1],0)

// Smooth with a Super Smoother Filter
Filt = ssFilter( HP, lowerBand )

Wave = ( Filt + nz(Filt[1],0) + nz(Filt[2],0) ) / 3
Pwr = ( Filt*Filt + nz(Filt[1],0)* nz(Filt[1],0) +  nz(Filt[2],0)* nz(Filt[2],0) ) /3

// Normalize the Average Wave to Square Root of the Average Power
sineWave = Wave / sqrt(Pwr)

// Output
sineWaveColor = sineWave>OB?green
            :  sineWave<OS?red
            :  change(sineWave)>0?green
            :  red

plot( sineWave, color=sineWaveColor, linewidth=3 )
plot( sineWave, color=sineWaveColor, linewidth=1, style=histogram )

hline(0, color=silver, linestyle=dotted)

Wow...! This indicator work well for any TF.
Thank you for your contribution.
Madrid, can you add a buy/sell signal button...?
Very interesting
Do you have any example how using it? and di you use 2 different TF or lenght?
Incredible! I have recently become a big fan of John Ehlers. Been making money on binary options with indicators coded by the excellent programmers we have in TV community. Thanks.
himansu000002 scsmith1967
@scsmith1967, which indicator do you use for binary options.
the BEST (and only) sine wave on TV. TY SIR
Excellent work, thank you. Only sinewave signal available for what I can see so far.
Looks pretty good!
首页 股票筛选器 外汇筛选器 加密货币筛选器 财经日历 如何运作 图表功能 价格 网站规则 版主 网站 & 经纪商解决方案 插件 图表解决方案 寻求帮助 功能请求 博客 & 新闻 常见问题 维基百科 Twitter
概述 个人资料设置 账号和账单 寻求帮助 已发表观点 粉丝 正在关注 私人消息 聊天 退出