見出し画像

Pine Script™ (v6) の覚書 - 作ってみる: StochasticsとRSIを描くインジケータの作成 (3)

前回までの話


線とラベルの描画

plot()とmylabel()を使って線とラベルを描画する。

Stochasticsの描画

plot(k,"%K",colorSTOK,widthSTOK)
if labelSTOK
    mylabel(k,"%K",labelbgSTOK,labeltextSTOK)
plot(d,"%D",colorSTOD,widthSTOD)
if labelSTOD
    mylabel(d,"%D",labelbgSTOD,labeltextSTOD)
plot(sd,"slow%D",colorSTOSD,widthSTOSD)
if labelSTOSD
    mylabel(sd,"slow%D",labelbgSTOSD,labeltextSTOSD)

RSIの描画


plot(rsis,"RSIs",colorRSIS,widthRSIS)
if labelRSIS
    mylabel(rsis,"RSI"+str.tostring(RSIS),labelbgRSIS,labeltextRSIS)
plot(rsim,"RSIm",colorRSIM,widthRSIM)
if labelRSIM
    mylabel(rsim,"RSI"+str.tostring(RSIM),labelbgRSIM,labeltextRSIM)

ラベルはinput.bool()を設定して、表示/非表示を切り替えられるようにしてある。

ここまでを描画してみると下の図のようになる。

図1 描画イメージ

続く


いいなと思ったら応援しよう!

rca
よろしければ応援お願いします!