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.
お気に入りスクリプトから削除 お気に入りスクリプトに追加
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)

コメント

How can I have this indicator alert when a divergence occurs?
+20 返信
Najjar-Nidhal normanroy
@normanroy, Did you find
it ?
+1 返信
how to set an alert? please help.
+12 返信
does it repaint? redraw ? does the signals come late ? what are the flaws
+10 返信
@djmc, Totally agree.. they are late
返信
Thanks for this awesome indicator, can you please explain more regarding "Gray circles on 4h macd is for those traders who want to check the confirmation on Elliott wave changes" ?
Thanks
+9 返信
Signals are very late...
+6 返信
"Please insert the indicator into a 1h chart, otherwise change the lengths' inputs"
where I change it, please? Which line?
thank you
+6 返信
VishalDesai Najjar-Nidhal
@Najjar-Nidhal, Did you find? where to change setting to 4h
返信
OMG
+2 返信
ホーム 株式スクリーナー FXスクリーナー 仮想通貨スクリーナー 経済指標カレンダー 使い方 チャート機能 価格 友達紹介 ハウスルール ヘルプセンター ウェブサイト&ブローカー向けソリューション ウィジェット チャートソリューション 軽量チャートライブラリ ブログ&ニュース ツイッター
プロフィール プロフィール設定 アカウントとお支払い 友達紹介 マイサポートチケット ヘルプセンター 公開したアイデア フォロワー フォロー中 プライベートメッセージ チャット サインアウト