yuya_takahashi_

Pine講座⑤ ボリンジャーバンドを表示する

Eğitim
yuya_takahashi_ Güncellendi   
FX:USDJPY   ABD Doları / Japon Yeni
今日はPineスクリプトでボリンジャーバンドを表示する方法です。

=====
//@version=3
study( "ボリンジャーバンドを表示する" ,overlay=true )

price = input( close ,title="計算の対象" )
length = input( 20 ,title="算出する期間" )
sma = sma( price ,length )
dev = stdev( price ,length )

plot( sma )
plot( sma + dev )
plot( sma + dev * 2 )
plot( sma - dev )
plot( sma - dev * 2 )
=====

Pineスクリプトでは、stdev( ) という標準偏差を算出する関数が用意されています。
いわゆる シグマ (σ) ですね。

シグマを算出して、足したり引いたりして plot( ) するだけです。

簡単ですね!
Yorum:
ご要望をいただいたので、各行に解説を追加します!

=====
//TradingView独自の宣言 PineScript ver.3で書くことを表す
//@version=3

//インジケーターのコードに必須
//"" で先頭に入力したものがタイトルになる
study( "ボリンジャーバンドを表示する" ,overlay=true )

//設定できる項目を指定し、その値を変数に格納
price = input( close ,title="計算の対象" )
length = input( 20 ,title="算出する期間" )

// sma( ) で単純移動平均を算出し、変数「sma」に格納
sma = sma ( price ,length )

//stde( ) で標準偏差を算出し、変数「dev」に格納
dev = stdev( price ,length )

// plot( ) で描画していく
plot( sma )
plot( sma + dev )
plot( sma + dev * 2 )
plot( sma - dev )
plot( sma - dev * 2 )
=====
Yorum:
次の講座

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

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

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

Benzer Fikirler

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.