SeaSide420

Normalized MACD (v420)

did i remove the EMA and replace it with HullMA?
yes
:-)

also some other maths added
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?
// Normalized MACD modified by SeaSide420. Normalized MACD v420
study("Normalized MACD (v420)",shorttitle='NmacD(v420)')
jah=input(title="HullMA cross",type=integer,defval=14)
tsp = input(33,title='Trigger')
np = input(50,title='Normalize')
h=input(false,title='Histogram')
docol = input(true,title="Color Change")
dofill=input(false,title="Fill")
n2ma=2*wma(close,round(jah/2))
nma=wma(close,jah)
diff=n2ma-nma
sqn=round(sqrt(jah))
n2ma1=2*wma(close[1],round(jah/2))
nma1=wma(close[1],jah)
diff1=n2ma1-nma1
sqn1=round(sqrt(jah))
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
sh=n1
lon=n2
ratio = min(sh,lon)/max(sh,lon)
Mac = (iff(sh>lon,2-ratio,ratio)-1)
MacNorm = ((Mac-lowest(Mac, np)) /(highest(Mac, np)-lowest(Mac, np)+.000001)*2)- 1
MacNorm2 = iff(np<2,Mac,MacNorm)
Trigger = wma(MacNorm2, tsp)
Hist =(MacNorm2-Trigger)
Hist2= Hist>1?1:Hist<-1?-1:Hist
swap = docol ? Hist2>0?green:red:black
swap1 = docol ? Hist2>Hist2[1]?red:green:black
swap2 = docol ? MacNorm2 > MacNorm2[1] ? #0094FF : #FF006E : red
swap3 = docol ? Trigger>0?green:red:black
hline(0)
plot(h?Hist2:na,color=swap2,style=columns,title='Hist',histbase=0)
plot(dofill?MacNorm2:na,color=swap1,style=columns)
teh=MacNorm2+MacNorm2[2]-MacNorm2[1]
n1e=plot(teh,color=black,title='MacNorm')
n2e=plot(Trigger,color=swap3, style=line, linewidth = 3, title='Trigger')
fill(n1e, n2e, color=swap, transp=50)
plot(cross(Trigger, MacNorm2) ? Trigger : na, style = cross,color=swap, linewidth = 4)
plot(cross(Trigger, MacNorm2) ? Trigger : na, style = cross,color=black, linewidth = 2)