![見出し画像](https://assets.st-note.com/production/uploads/images/171976895/rectangle_large_type_2_8abd26ccd3ddc8745933a5530b544bd5.png?width=1200)
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()を設定して、表示/非表示を切り替えられるようにしてある。
ここまでを描画してみると下の図のようになる。
![](https://assets.st-note.com/img/1738299772-PSoJELH9cu3s6XdIhQ1T0iBD.png?width=1200)
続く
いいなと思ったら応援しよう!
![rca](https://d2l930y2yx77uc.cloudfront.net/assets/default/default_profile_3-39088fff430aa9ec11d6e2a385dbcad45c8b79bde6c0c9ded10cd7abb960174f.png?width=600&crop=1:1,smart)