U.S. Dollar / Japanese Yen
Education
Updated

Pine講座⑪ 2行でATRを表示する

2996
Pineスクリプトはオシレーター系の指標の描画も簡単です。
ほとんどの指標を2行で出力できると思います。

今日はATR。

=====
//version=3
study( "2行でATRを表示する" )
plot( ema( tr ,20 ) )
=====

Pineスクリプトでは、「tr」という独自変数があります。
これは、close、openなどと同じようにtr(True Range)を取得することができる変数です。

atr( ) という関数も用意されていますが、
EMA(指数平滑移動平均)のATRが欲しいので ema( tr ,20 ) として算出しています。
Note
次の講座
Pine講座⑫ 1000本遡ったATRの均衡点を表示する

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.