OPEN-SOURCE SCRIPT

MACD DEMA by Toff

MACD DEMA by Toff
converted to version 5
Changed Histogram formatting
Changed MACD plot to indicate macd direction change

//version=5
//by ToFFF converted to version 5, changed histogram formating changed macd plot to show macd direction changed with lighter color
indicator('MACD DEMA', timeframe = "", timeframe_gaps=true)
sma = input(12,title='DEMA Short')
lma = input(26,title='DEMA Long')
tsp = input(9,title='Signal')
lines = input(true,title="Lines")
col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above")
col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above")
col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below")
col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below")
col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")
col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")
col_macd_i = #0000FF
col_macd_d = #66FFFF

slowa = ta.ema(close,lma)
slowb = ta.ema(slowa,lma)
DEMAslow = ((2 * slowa) - slowb)

fasta = ta.ema(close,sma)
fastb = ta.ema(fasta,sma)
DEMAfast = ((2 * fasta) - fastb)

MACD = (DEMAfast - DEMAslow)

signala = ta.ema(MACD, tsp)
signalb = ta.ema(signala, tsp)
signal = ((2 * signala) - signalb)

hist = (MACD - signal)

//swap1 = MACDZeroLag>0?green:red

plot(hist,style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below)),title='HIST')
p1 = plot(lines?MACD:na,style = plot.style_line, color=(MACD[1] < MACD) ? col_macd_i : col_macd_d , linewidth =3,title='MACD')
p2 = plot(lines?signal:na, color=col_signal, linewidth =2,title='Signal')

hline(0)

Centered OscillatorsdoubleemaMoving Average Convergence / Divergence (MACD)macdivergence

Script open-source

Dans le plus pur esprit TradingView, l'auteur de ce script l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par nos Règles. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?

Clause de non-responsabilité