U.S. Dollar / Japanese Yen
Education
Updated

Pine講座⑨ ハイローバンドにブレイクも表示する

2108
昨日のプログラムに2行追加するだけで、
ブレイクを表示することができるようになります。

今日は追加部分だけ解説を入れますね。

==========
//version=3
study( "ハイローバンドとプレイクを表示する" ,overlay=true )

length = input( 20 ,title="計算する期間" )

highest = highest( high ,length )
lowest = lowest( low ,length )
middle = ( highest + lowest ) / 2

plot( middle ,offset=1 ,color=red )

p1 = plot( highest ,offset=1 )
p2 = plot( lowest ,offset=1 )

fill( p1 ,p2 )

// チャートにshapeを描画する
// high > highest[1](最高値のブレイク)のときだけ描画
// highest[1] は1本前のデータを取得している
plotshape( high > highest[1] ,location=location.abovebar ,style=shape.triangleup ,color=gray )

// low < lowest[1](最安値のブレイク)のときだけ描画
plotshape( low < lowest[1] ,location=location.belowbar ,style=shape.triangledown ,color=gray )
==========
Note
次の講
Pine講座⑩ GMMA を表示する

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.