BURSATRENDBANDCHART

SIRI PINE SCRIPT - Gabungan plot, label dan nilai peratus

Utbildning
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

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.