OPEN-SOURCE SCRIPT
Updated

Pips per Candle - XAUUSD

65
//version=5
indicator("Pips per Candle - XAUUSD", overlay=true)

// Opsi tampilkan label di atas atau bawah
tampilkan_di_atas = input.bool(true, "Tampilkan di atas candle")
tampilkan_di_bawah = input.bool(true, "Tampilkan di bawah candle")
tampilkan_berdasarkan = input.string("High-Low", title="Hitung pips berdasarkan", options=["High-Low", "Open-Close"])

// Hitung pip
perbedaan = tampilkan_berdasarkan == "High-Low" ? high - low : math.abs(close - open)
pip = perbedaan * 100 // 1 point = 100 pip untuk XAU

// Bersihkan label lama
var label[] labels = array.new_label()
if bar_index > 1
for i = 0 to array.size(labels) - 1
label.delete(array.get(labels, i))
array.clear(labels)

// Tampilkan label
if tampilkan_di_atas
array.push(labels, label.new(bar_index, high, text=str.tostring(pip, "#.0") + " pip", style=label.style_label_up, textcolor=color.white, size=size.small, color=color.orange))

if tampilkan_di_bawah
array.push(labels, label.new(bar_index, low, text=str.tostring(pip, "#.0") + " pip", style=label.style_label_down, textcolor=color.white, size=size.small, color=color.maroon))
Release Notes
Pips per Candle

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.