BURSATRENDBANDCHART

SIRI PINE SCRIPT - Gabungan plot, label dan nilai peratus

교육
FTSEMYX:FBMKLCI   FTSE 말레이시아 증권거래소 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

면책사항

이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.