yuya_takahashi_

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

Education
FX:USDJPY   U.S. Dollar / Japanese Yen
昨日のプログラムに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(最高値のブレイク)のときだけ描画
// highest は1本前のデータを取得している
plotshape( high > highest ,location=location.abovebar ,style=shape.triangleup ,color=gray )

// low < lowest(最安値のブレイク)のときだけ描画
plotshape( low < lowest ,location=location.belowbar ,style=shape.triangledown ,color=gray )
==========
Comment:
次の講

小次郎講師公式インジケーターのお申込
bit.ly/2vdSV4Q

小次郎講師のLINE@
bit.ly/2VZQFu3

小次郎講師のチャート情報局
bit.ly/2GvLAEp

Related Ideas

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.