lonestar108

S3-ZMACD

Here's a modified MACD which uses ZL calculation for the emas, phi adjustment to the fast signal and an optimized period set. It useful because it will give predictive signals for many setups.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//
// @author lonestar108
//
study(title = "S3ZMACD", shorttitle="S3ZMACD", overlay=false)

src=close

lengtha=input(3)
emaa=ema(src, lengtha)
emas=ema(emaa, lengtha)
da=emaa-emas
zemaa=emaa+da

length1=input(9)
ema1=ema(src, length1)
ema2=ema(ema1, length1)
d1=ema1-ema2
zema1=ema1+d1

length2=input(27)
ema3=ema(src, length2)
ema4=ema(ema3, length2)
d2=ema3-ema4
zema2=ema3+d2

length3=input(81)
ema5=ema(src, length3)
ema6=ema(ema5, length3)
d3=ema5-ema6
zema3=ema5+d3

length4=input(108)
ema7=ema(src, length4)
ema8=ema(ema5, length4)
d4=ema7-ema8
zema4=ema7+d4

emabase=zema4-zema3
emaslow=zema3-zema2
emafast=zema2-zema1
emarapid=(zema2-zemaa) * 1.618
emahyper=(zemaa-close) * 1.618

//gemb = emafast > 0 ? ( emaslow * emafast ) + (emarapid - emafast) : ( emaslow * emafast )
//gemb = emaslow > emafast ? emaslow - (emarapid - emafast) : emaslow + (emarapid - emafast)
eslow=emaslow

ea=(-eslow-emahyper) > 10 ? 10 : ( (-eslow-emahyper) < -10  ? -10 : (-eslow-emahyper))
pa=plot(ea, color=yellow, linewidth=2)

eb=-eslow > 10 ? 10 : (-eslow < -10 ? -10 : -eslow)
pb=plot(eb, color= #FF4405, linewidth=3)

fill(pa, pb, yellow, transp=50)

ebb=-emabase > 10 ? 10 : (-emabase < -10 ? -10 : -emabase)
pbb=plot(ebb, color= aqua, linewidth=3)

ec=-emarapid > 10 ? 10 : (-emarapid < -10 ? -10 : -emarapid)
pc=plot(ec, color= #84FFC0, linewidth=1)

ed=-emafast > 10 ? 10 : (-emafast < -10 ? -10 : -emafast)
pd=plot(ed, color= #18CC3D, linewidth=1)
fill(pc, pd, #84FFC0, transp=50)

hline(0)
hline(10)
hline(-10)