BURSATRENDBANDCHART

SIRI PINE SCRIPT - Gabungan plot, label dan nilai peratus

教育
FTSEMYX:FBMKLCI   富時吉隆坡綜合指數
Saya cuba gabungkan antara plot, buat sedikit kiraan peratus dan masukkan ke dalam label.

Dengan gunakan templat yang sama, lebih banyak lagi yang info kita boleh masukkan ke dalam label, tidak limit kepada nilai open, high, low dan close sahaja.

Code dalam video :

// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © BURSATRENDBANDCHART

//@version=4
study("52WHL" , overlay = true)

weekly_h = security(syminfo.tickerid, "W", highest(high, 52), lookahead=barmerge.lookahead_on)
weekly_l = security(syminfo.tickerid, "W", lowest(low, 52), lookahead=barmerge.lookahead_on)

high_percent = tostring((close - weekly_h) / weekly_h, "##.##%")
low_percent = tostring((close-weekly_l)/weekly_l, "##.##%")

labelhighlow = label.new(bar_index, na, 'High :' +high_percent+
'\nLow :' +low_percent,
color = color.blue,
textcolor = color.white,
style=label.style_labeldown, yloc=yloc.abovebar)
label.delete(labelhighlow)

plot(weekly_h, title='52 Week High', trackprice=true, color=color.orange, offset=-9999)
plot(weekly_l, title='52 Week Low', trackprice=true, color=color.orange, offset=-9999)

// End

Sumber code 52week high : 52 Week High/Low oleh BacktestRookies

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。