label と line を応用して、
簡単なインジケーターを作成してみます。
今回つくるのは、最新の終値から
上下に2-ATRのところにラインを引くインジケーターです。
※ 以下のコードは、[]を半角の「[]」に書き換える必要があります
=====
//version=4
study( "終値から ±2-ATR にラインを描画する" ,overlay=true )
//ローソク足 1本分の時間を取得
dt = time - time[1]
//ATRを算出
atr20 = ema( tr ,20 )
//終値から±2-ATRの値を算出
c_p_2atr = close + atr20[1] * 2
c_m_2atr = close - atr20[1] * 2
// line を描画
var line upper = na
var line lower = na
line.delete( upper )
line.delete( lower )
upper := line.new( time-10*dt ,c_p_2atr ,time+30*dt ,c_p_2atr ,xloc.bar_time ,color=color.red )
lower := line.new( time-10*dt ,c_m_2atr ,time+30*dt ,c_m_2atr ,xloc.bar_time ,color=color.red )
// label を描画
var label label_top = na
var label label_bottom = na
label.delete( label_top )
label.delete( label_bottom )
label_top := label.new( time-10*dt ,c_p_2atr ,xloc=xloc.bar_time ,text="+2ATR" ,style=label.style_none )
label_bottom := label.new( time-10*dt ,c_m_2atr ,xloc=xloc.bar_time ,text="-2ATR" ,style=label.style_none )
=====
簡単なインジケーターを作成してみます。
今回つくるのは、最新の終値から
上下に2-ATRのところにラインを引くインジケーターです。
※ 以下のコードは、[]を半角の「[]」に書き換える必要があります
=====
//version=4
study( "終値から ±2-ATR にラインを描画する" ,overlay=true )
//ローソク足 1本分の時間を取得
dt = time - time[1]
//ATRを算出
atr20 = ema( tr ,20 )
//終値から±2-ATRの値を算出
c_p_2atr = close + atr20[1] * 2
c_m_2atr = close - atr20[1] * 2
// line を描画
var line upper = na
var line lower = na
line.delete( upper )
line.delete( lower )
upper := line.new( time-10*dt ,c_p_2atr ,time+30*dt ,c_p_2atr ,xloc.bar_time ,color=color.red )
lower := line.new( time-10*dt ,c_m_2atr ,time+30*dt ,c_m_2atr ,xloc.bar_time ,color=color.red )
// label を描画
var label label_top = na
var label label_bottom = na
label.delete( label_top )
label.delete( label_bottom )
label_top := label.new( time-10*dt ,c_p_2atr ,xloc=xloc.bar_time ,text="+2ATR" ,style=label.style_none )
label_bottom := label.new( time-10*dt ,c_m_2atr ,xloc=xloc.bar_time ,text="-2ATR" ,style=label.style_none )
=====
小次郎講師公式インジケーターのお申込
bit.ly/2vdSV4Q
小次郎講師のLINE@
bit.ly/2VZQFu3
小次郎講師のチャート情報局
bit.ly/2GvLAEp
bit.ly/2vdSV4Q
小次郎講師のLINE@
bit.ly/2VZQFu3
小次郎講師のチャート情報局
bit.ly/2GvLAEp
相關出版品
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
小次郎講師公式インジケーターのお申込
bit.ly/2vdSV4Q
小次郎講師のLINE@
bit.ly/2VZQFu3
小次郎講師のチャート情報局
bit.ly/2GvLAEp
bit.ly/2vdSV4Q
小次郎講師のLINE@
bit.ly/2VZQFu3
小次郎講師のチャート情報局
bit.ly/2GvLAEp
相關出版品
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。