FantasticFox

MACD Divergence MultiTimeFrame [FantasticFox]

This is a MACD divergence on 3 time-frames, 1h, 4h and 1D.
Please insert the indicator into a 1h chart, otherwise change the lengths' inputs.

you will see H1,H2, H3, R1, R2 and R3 in green and maroon colors.
H means hidden divergence, 1 regards to 1h, 2 to 4h, and 3 to 1D. If the color is green, its bullish, and if its maroon the divergence is bearish.

Gray circles on 4h macd is for those traders who want to check the confirmation on Elliott wave changes.

*Thanks to RicardoSantos MACD divergence.
오픈 소스 스크립트

이 스크립트의 오써는 참된 트레이딩뷰의 스피릿으로 이 스크립트를 오픈소스로 퍼블리쉬하여 트레이더들로 하여금 이해 및 검증할 수 있도록 하였습니다. 오써를 응원합니다! 스크립트를 무료로 쓸 수 있지만, 다른 퍼블리케이션에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.

차트에 이 스크립트를 사용하시겠습니까?
study(title='MACD Divergence MultiTimeFrame [FantasticFox]', shorttitle='MACD Div MTF')
source = input(close)

f_top_indy(_source)=>_source[4] < _source[2] and _source[3] < _source[2] and _source[2] > _source[1] and _source[2] > _source[0]
f_bot_indy(_source)=>_source[4] > _source[2] and _source[3] > _source[2] and _source[2] < _source[1] and _source[2] < _source[0]
f_indyize(_source)=>f_top_indy(_source) ? 1 : f_bot_indy(_source) ? -1 : 0

fastLength1 = input(12, minval=1), slowLength1=input(26,minval=1)
fastMA1 = ema(source, fastLength1)
slowMA1 = ema(source, slowLength1)
macd1 = fastMA1 - slowMA1 
plot(macd1, color=aqua, linewidth=1)


indy_top1 = f_indyize(macd1) > 0 ? macd1[2] : na
indy_bot1 = f_indyize(macd1) < 0 ? macd1[2] : na

high_prev1 = valuewhen(indy_top1, macd1[2], 1) 
high_price1 = valuewhen(indy_top1, high[2], 1)
low_prev1 = valuewhen(indy_bot1, macd1[2], 1) 
low_price1 = valuewhen(indy_bot1, low[2], 1)

regular_bearish_div1 = indy_top1 and high[2] > high_price1 and macd1[2] < high_prev1
hidden_bearish_div1 = indy_top1 and high[2] < high_price1 and macd1[2] > high_prev1
regular_bullish_div1 = indy_bot1 and low[2] < low_price1 and macd1[2] > low_prev1
hidden_bullish_div1 = indy_bot1 and low[2] > low_price1 and macd1[2] < low_prev1


plotshape(title='+RD', series=regular_bearish_div1 ? macd1[2] : na, text='R1', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='+HD', series=hidden_bearish_div1 ? macd1[2] : na, text='H1', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='-RD', series=regular_bullish_div1 ? macd1[2] : na, text='R1', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
plotshape(title='-HD', series=hidden_bullish_div1 ? macd1[2] : na, text='H1', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)

/////// 4h

fastLength2 = input(48, minval=1), slowLength2=input(104,minval=1)
fastMA2 = ema(source, fastLength2)
slowMA2 = ema(source, slowLength2)
macd2 = fastMA2 - slowMA2
plot(macd2, color=aqua, linewidth=1)


indy_top2 = f_indyize(macd2) > 0 ? macd2[2] : na
indy_bot2 = f_indyize(macd2) < 0 ? macd2[2] : na

high_prev2 = valuewhen(indy_top2, macd2[2], 1) 
high_price2 = valuewhen(indy_top2, high[2], 1)
low_prev2 = valuewhen(indy_bot2, macd2[2], 1) 
low_price2 = valuewhen(indy_bot2, low[2], 1)

regular_bearish_div2 = indy_top2 and high[2] > high_price2 and macd2[2] < high_prev2
hidden_bearish_div2 = indy_top2 and high[2] < high_price2 and macd2[2] > high_prev2
regular_bullish_div2 = indy_bot2 and low[2] < low_price2 and macd2[2] > low_prev2
hidden_bullish_div2 = indy_bot2 and low[2] > low_price2 and macd2[2] < low_prev2


plotshape(title='+RD', series=regular_bearish_div2 ? macd2[2] : na, text='R2', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='+HD', series=hidden_bearish_div2 ? macd2[2] : na, text='H2', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='-RD', series=regular_bullish_div2 ? macd2[2] : na, text='R2', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
plotshape(title='-HD', series=hidden_bullish_div2 ? macd2[2] : na, text='H2', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)

////////// 1D

fastLength3 = input(288, minval=1), slowLength3=input(624,minval=1)
fastMA3 = ema(source, fastLength3)
slowMA3 = ema(source, slowLength3)
macd3 = fastMA3 - slowMA3
plot(macd3, color=aqua, linewidth=1)


indy_top3 = f_indyize(macd3) > 0 ? macd3[2] : na
indy_bot3 = f_indyize(macd3) < 0 ? macd3[2] : na

high_prev3 = valuewhen(indy_top3, macd3[2], 1) 
high_price3 = valuewhen(indy_top3, high[2], 1)
low_prev3 = valuewhen(indy_bot3, macd3[2], 1) 
low_price3 = valuewhen(indy_bot3, low[2], 1)

regular_bearish_div3 = indy_top3 and high[2] > high_price3 and macd3[2] < high_prev3
hidden_bearish_div3 = indy_top3 and high[2] < high_price3 and macd3[2] > high_prev3
regular_bullish_div3 = indy_bot3 and low[2] < low_price3 and macd3[2] > low_prev3
hidden_bullish_div3 = indy_bot3 and low[2] > low_price3 and macd3[2] < low_prev3


plotshape(title='+RD', series=regular_bearish_div3 ? macd3[2] : na, text='R3', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='+HD', series=hidden_bearish_div3 ? macd3[2] : na, text='H3', style=shape.labeldown, location=location.absolute, color=maroon, textcolor=white, offset=-2)
plotshape(title='-RD', series=regular_bullish_div3 ? macd3[2] : na, text='R3', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
plotshape(title='-HD', series=hidden_bullish_div3 ? macd3[2] : na, text='H3', style=shape.labelup, location=location.absolute, color=green, textcolor=white, offset=-2)
///////////////

plot(title='H D', series=indy_top2, style=circles, color=regular_bearish_div2 or hidden_bearish_div2 ? maroon : gray, linewidth=3, offset=-2)
plot(title='L D', series=indy_bot2, style=circles, color=regular_bullish_div2 or hidden_bullish_div2 ? green : gray, linewidth=3, offset=-2)