BURSATRENDBANDCHART

SIRI PINE SCRIPT - Gabungan plot, label dan nilai peratus

Formación
FTSEMYX:FBMKLCI   Índice FTSE Bursa Malaysia KLCI
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

Exención de responsabilidad

La información y las publicaciones que ofrecemos, no implican ni constituyen un asesoramiento financiero, ni de inversión, trading o cualquier otro tipo de consejo o recomendación emitida o respaldada por TradingView. Puede obtener información adicional en las Condiciones de uso.