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

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?

Penafian