BURSATRENDBANDCHART

SIRI PINE SCRIPT - Gabungan plot, label dan nilai peratus

Ausbildung
FTSEMYX:FBMKLCI   FTSE Bursa Malaysia KLCI Index
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

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.