U.S. Dollar / Japanese Yen
Education
Updated

Pine講座⑮ MACDを表示する

3032
MACDは描画する要素が多いので
「2行で」というわけにはいきませんが、

組み込みの関数で簡単に描画することができます。

今日からは Pineスクリプト v4 で
プログラムを書いていきたいと思います!

=====
//version=4
study( "MACDを表示する" )

//macd( ) で MACD を算出する
//macd( ) は唯一、配列で算出結果を受け取る
[macdLine ,signalLine ,histLine] = macd(close ,12 ,26 ,9)

//MACDの各計算値を描画する
plot(macdLine ,color=color.blue)
plot(signalLine ,color=color.orange)
plot(histLine ,color=color.red ,style=plot.style_histogram)
=====
Note
次の講座
Pine講座⑯ 2行で日経平均の終値(30分足)を表示する
Note
コードに間違いがありました。

= macd (close ,12 ,26 ,9)
 ↓ ↓ ↓
[macdLine, signalLine, histLine] = macd (close ,12 ,26 ,9)
Note
= macd (close ,12 ,26 ,9)
 ↓ ↓ ↓
[macdLine, signalLine, histLine] = macd (close ,12 ,26 ,9)
※[]を半角に直してお使いください

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.