スクリーンショット_2019-12-31_13_14_35

普通のMACDインジケーター(アラート機能付き)【TradingView】

こんにちは、まっつ@matsu_bitmex です。無料で使えるアラート機能付きMACDを公開しました。

TradingViewで「MACD with alert」と検索すると使えます。

スクリーンショット 2019-12-31 13.11.54


スクリーンショット 2019-12-31 13.06.23


アラートはゴールデンクロス・デッドクロス、ヒストグラム増減、と設定できます。


設定について。

スクリーンショット 2019-12-31 13.06.35

○ source
○ short EMA length
○ long EMA length
○ signal length
MACDの設定項目です。

○ check histogram alert points
アラートが鳴る箇所が確認できます。


スクリーンショット 2019-12-31 13.11.33


1. GC/DC
MACD・シグナルのゴールデンクロス・デッドクロスでアラート。

2. GC
MACD・シグナルのゴールデンクロスでアラート。

3. DC
MACD・シグナルのデッドクロスでアラート。

4. histogram color change
ヒストグラムの色が変わったタイミングでアラート。

5. histogram increase
ヒストグラムの色が変わったタイミングでアラート。(上昇のみ)

6. histogram decrease
ヒストグラムの色が変わったタイミングでアラート。(下降のみ)


以上、簡単ではありますがインジの説明になります。

最後にソースコードを。

//@version=3
study("MACD with alert", precision=1)

// input -----
src = input(close, "source")
s_len = input(12, "short EMA length")
l_len = input(26, "long EMA length")
sig_len = input(9, "signal length")
check = input(false, "check histogram alert points")

// MACD -----
[macd, sig, hist] = macd(src, s_len, l_len, sig_len)
gc = crossover(macd, sig)
dc = crossunder(macd, sig)

// histogram pattern -----
hist_up_plus = hist > 0 and hist > hist[1]
hist_down_plus = hist > 0 and hist < hist[1]
hist_up_minus = hist < 0 and hist > hist[1]
hist_down_minus = hist < 0 and hist < hist[1]

hist_color = hist_up_plus ? lime : hist_down_plus ? green : hist_up_minus ? maroon : red

// plot -----
plot(hist, "histogram", hist_color, 2, histogram)
plot(sig, "signal", #ff6a00, 2, transp=0)
plot(macd, "MACD", #0094ff, 3, transp=0)
plot(macd, "GC/DC", gc ? lime : dc ? red : na, 2, circles, transp=0)

// alert -----
hist_up = (hist_up_plus or hist_up_minus) and hist[1] < hist[2]
hist_down = (hist_down_plus or hist_down_minus) and hist[1] > hist[2]

plotchar(check and (hist_up or crossover(hist, 0)), "histogram increase", "*", location.bottom, lime, 20)
plotchar(check and (hist_down or crossunder(hist, 0)), "histogram decrease", "*", location.top, red, 0)

alertcondition(gc or dc, "1. GC/DC", "MACD alert")
alertcondition(gc, "2. GC", "MACD alert")
alertcondition(dc, "3. DC", "MACD alert")

alertcondition(hist_up or hist_down or cross(hist, 0), "4. histogram color change", "histogram alert")
alertcondition(hist_up or crossover(hist, 0), "5. histogram increase", "histogram alert")
alertcondition(hist_down or crossunder(hist, 0), "6. histogram decrease", "histogram alert")


最後まで読んでいただきありがとうございました。このインジがよかったよ、という方はぜひぜひnoteのフォロー・スキお願いします。インジの作成・ご相談も受け付けていますのでお気軽にTwitter DMください。

ではまた次のnoteで!

この記事が気に入ったらサポートをしてみませんか?