← Back to GoldScan
GOLDSCAN

Public Data Panel — Pine Script

Add this to your own TradingView chart to see the same Gold / EURUSD / DXY reference data, RSI readings, and session levels that the GoldScan scanner uses as its secondary confidence check. Screenshotting your chart with this panel visible gives the scanner more to work with.

  1. Copy the script below.
  2. In TradingView, open a XAUUSD chart on the 5-minute timeframe.
  3. Click Pine Editor (bottom panel) → clear the default script → paste this in.
  4. Click Add to chart.
  5. Make sure at least 10 candles are visible before screenshotting for a scan.
//@version=5
indicator("GoldScan Public Data Panel", overlay=true, max_labels_count=500)

// ============================================================
// PUBLIC VERSION — for use alongside the GoldScan scanner app.
// This shows the same Gold/EURUSD/DXY reference data and RSI
// readings the app looks at for its secondary confidence check.
// ============================================================

// ============================================================
// INPUTS
// ============================================================
eurusdSymbol  = input.symbol("OANDA:EURUSD", "EURUSD Symbol")
dxySymbol     = input.symbol("TVC:DXY", "DXY Symbol")
showDebug     = input.bool(true, "Show Data Panel")
bbLength      = input.int(20, "BB/Squeeze Length")
volMultiplier = input.float(1.2, "Volume Spike Multiplier")

// ============================================================
// 1-MINUTE REFERENCE DATA
// ============================================================
eurusdClose1  = request.security(eurusdSymbol, "1", close[1])
eurusdOpen1   = request.security(eurusdSymbol, "1", open[1])
dxyClose1     = request.security(dxySymbol, "1", close[1])
dxyOpen1      = request.security(dxySymbol, "1", open[1])

eurusdCurrent = request.security(eurusdSymbol, "1", close)
dxyCurrent    = request.security(dxySymbol, "1", close)

goldClose1    = close[1]
goldCurrent   = close

goldGreenLast   = close[1] > open[1]
goldRedLast     = close[1] < open[1]
eurusdGreenLast = eurusdClose1 > eurusdOpen1
eurusdRedLast   = eurusdClose1 < eurusdOpen1
dxyGreenLast    = dxyClose1 > dxyOpen1
dxyRedLast      = dxyClose1 < dxyOpen1

// ============================================================
// 5m / 15m REFERENCE DATA
// ============================================================
eurusdClose5  = request.security(eurusdSymbol, "5", close[1])
eurusdOpen5   = request.security(eurusdSymbol, "5", open[1])
eurusdClose15 = request.security(eurusdSymbol, "15", close[1])
eurusdOpen15  = request.security(eurusdSymbol, "15", open[1])

dxyClose5     = request.security(dxySymbol, "5", close[1])
dxyOpen5      = request.security(dxySymbol, "5", open[1])
dxyClose15    = request.security(dxySymbol, "15", close[1])
dxyOpen15     = request.security(dxySymbol, "15", open[1])

goldClose5    = request.security(syminfo.tickerid, "5", close[1])
goldOpen5     = request.security(syminfo.tickerid, "5", open[1])
goldClose15   = request.security(syminfo.tickerid, "15", close[1])
goldOpen15    = request.security(syminfo.tickerid, "15", open[1])

eurusdGreen5  = eurusdClose5  > eurusdOpen5
eurusdRed5    = eurusdClose5  < eurusdOpen5
eurusdGreen15 = eurusdClose15 > eurusdOpen15
eurusdRed15   = eurusdClose15 < eurusdOpen15

dxyGreen5     = dxyClose5  > dxyOpen5
dxyRed5       = dxyClose5  < dxyOpen5
dxyGreen15    = dxyClose15 > dxyOpen15
dxyRed15      = dxyClose15 < dxyOpen15

goldGreen5    = goldClose5  > goldOpen5
goldRed5      = goldClose5  < goldOpen5
goldGreen15   = goldClose15 > goldOpen15
goldRed15     = goldClose15 < goldOpen15

// ============================================================
// SQUEEZE / VOLUME STATE (CAUTION / NORMAL / QUIET)
// ============================================================
bbBasis    = ta.sma(close, bbLength)
bbDev      = ta.stdev(close, bbLength) * 2
bbUpper    = bbBasis + bbDev
bbLower    = bbBasis - bbDev
bbWidth    = (bbUpper - bbLower) / bbBasis
bbWidthLow = ta.lowest(bbWidth, bbLength)

squeezeOn = bbWidth <= bbWidthLow * 1.05
volAvg    = ta.sma(volume, bbLength)
volRising = volume > volAvg * volMultiplier

dirUp   = close > close[3]
dirDown = close < close[3]

stateText  = "NORMAL"
stateColor = color.green

if squeezeOn and volRising
    stateText  := dirUp ? "CAUTION ▲" : dirDown ? "CAUTION ▼" : "CAUTION ?"
    stateColor := color.orange
else if squeezeOn and not volRising
    stateText  := "QUIET"
    stateColor := color.blue
else
    stateText  := "NORMAL"
    stateColor := color.green

// ============================================================
// RSI - 1min / 5min / 15min / Average
// ============================================================
rsi1  = request.security(syminfo.tickerid, "1", ta.rsi(close, 14))
rsi5  = request.security(syminfo.tickerid, "5", ta.rsi(close, 14))
rsi15 = request.security(syminfo.tickerid, "15", ta.rsi(close, 14))
rsiAvg = (rsi1 + rsi5 + rsi15) / 3

rsi1Text   = (rsi1   < 50 ? "- " : "+ ") + str.tostring(rsi1, "#.#")
rsi5Text   = (rsi5   < 50 ? "- " : "+ ") + str.tostring(rsi5, "#.#")
rsi15Text  = (rsi15  < 50 ? "- " : "+ ") + str.tostring(rsi15, "#.#")
rsiAvgText = (rsiAvg < 50 ? "- " : "+ ") + str.tostring(rsiAvg, "#.#")

rsi1Color   = rsi1   < 50 ? color.red : color.green
rsi5Color   = rsi5   < 50 ? color.red : color.green
rsi15Color  = rsi15  < 50 ? color.red : color.green
rsiAvgColor = rsiAvg < 50 ? color.red : color.green

// ============================================================
// SESSION HIGH/LOW LINES (previous day only, SAST)
// ============================================================
asiaSess   = "0005-0800:1234567"
londonSess = "0800-1600:1234567"
nySess     = "1600-2259:1234567"

inAsia   = not na(time(timeframe.period, asiaSess, "GMT+2"))
inLondon = not na(time(timeframe.period, londonSess, "GMT+2"))
inNY     = not na(time(timeframe.period, nySess, "GMT+2"))

var float asiaHigh = na
var float asiaLow  = na
var float londonHigh = na
var float londonLow  = na
var float nyHigh = na
var float nyLow  = na

var float asiaHighPrev   = na
var float asiaLowPrev    = na
var float londonHighPrev = na
var float londonLowPrev  = na
var float nyHighPrev     = na
var float nyLowPrev      = na

if inAsia
    asiaHigh := na(asiaHigh) ? high : math.max(asiaHigh, high)
    asiaLow  := na(asiaLow)  ? low  : math.min(asiaLow, low)
else if not na(asiaHigh)
    asiaHighPrev := asiaHigh
    asiaLowPrev  := asiaLow
    asiaHigh := na
    asiaLow  := na

if inLondon
    londonHigh := na(londonHigh) ? high : math.max(londonHigh, high)
    londonLow  := na(londonLow)  ? low  : math.min(londonLow, low)
else if not na(londonHigh)
    londonHighPrev := londonHigh
    londonLowPrev  := londonLow
    londonHigh := na
    londonLow  := na

if inNY
    nyHigh := na(nyHigh) ? high : math.max(nyHigh, high)
    nyLow  := na(nyLow)  ? low  : math.min(nyLow, low)
else if not na(nyHigh)
    nyHighPrev := nyHigh
    nyLowPrev  := nyLow
    nyHigh := na
    nyLow  := na

plot(asiaHighPrev,   color=color.new(color.green, 0), linewidth=1, title="Asia High")
plot(asiaLowPrev,    color=color.new(color.green, 0), linewidth=1, title="Asia Low")
plot(londonHighPrev, color=color.new(color.blue, 0),  linewidth=1, title="London High")
plot(londonLowPrev,  color=color.new(color.blue, 0),  linewidth=1, title="London Low")
plot(nyHighPrev,     color=color.new(color.red, 0),   linewidth=1, title="NY High")
plot(nyLowPrev,      color=color.new(color.red, 0),   linewidth=1, title="NY Low")

// ============================================================
// DATA PANEL — two-block layout
// ============================================================
var table debugTable = table.new(position.middle_right, 5, 9, bgcolor=color.new(color.black, 0), border_width=2, border_color=color.gray)

eurLabel1  = eurusdGreenLast ? "GREEN" : eurusdRedLast ? "RED" : "FLAT"
eurColor1  = eurusdGreenLast ? color.green : eurusdRedLast ? color.red : color.gray
eurLabel5  = eurusdGreen5 ? "GREEN" : eurusdRed5 ? "RED" : "FLAT"
eurColor5  = eurusdGreen5 ? color.green : eurusdRed5 ? color.red : color.gray
eurLabel15 = eurusdGreen15 ? "GREEN" : eurusdRed15 ? "RED" : "FLAT"
eurColor15 = eurusdGreen15 ? color.green : eurusdRed15 ? color.red : color.gray

dxyLabel1  = dxyGreenLast ? "GREEN" : dxyRedLast ? "RED" : "FLAT"
dxyColor1  = dxyGreenLast ? color.green : dxyRedLast ? color.red : color.gray
dxyLabel5  = dxyGreen5 ? "GREEN" : dxyRed5 ? "RED" : "FLAT"
dxyColor5  = dxyGreen5 ? color.green : dxyRed5 ? color.red : color.gray
dxyLabel15 = dxyGreen15 ? "GREEN" : dxyRed15 ? "RED" : "FLAT"
dxyColor15 = dxyGreen15 ? color.green : dxyRed15 ? color.red : color.gray

goldLabel1  = goldGreenLast ? "GREEN" : goldRedLast ? "RED" : "FLAT"
goldColor1  = goldGreenLast ? color.green : goldRedLast ? color.red : color.gray
goldLabel5  = goldGreen5 ? "GREEN" : goldRed5 ? "RED" : "FLAT"
goldColor5  = goldGreen5 ? color.green : goldRed5 ? color.red : color.gray
goldLabel15 = goldGreen15 ? "GREEN" : goldRed15 ? "RED" : "FLAT"
goldColor15 = goldGreen15 ? color.green : goldRed15 ? color.red : color.gray

if showDebug and barstate.islast
    table.cell(debugTable, 0, 0, "EUR 1m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 0, str.tostring(eurusdClose1, "#.#####") + "\n" + eurLabel1, text_color=eurColor1, text_size=size.small)

    table.cell(debugTable, 0, 1, "EUR 5m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 1, str.tostring(eurusdClose5, "#.#####") + "\n" + eurLabel5, text_color=eurColor5, text_size=size.small)

    table.cell(debugTable, 0, 2, "EUR 15m", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 2, str.tostring(eurusdClose15, "#.#####") + "\n" + eurLabel15, text_color=eurColor15, text_size=size.small)

    table.cell(debugTable, 0, 3, "DXY 1m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 3, str.tostring(dxyClose1, "#.###") + "\n" + dxyLabel1, text_color=dxyColor1, text_size=size.small)

    table.cell(debugTable, 0, 4, "DXY 5m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 4, str.tostring(dxyClose5, "#.###") + "\n" + dxyLabel5, text_color=dxyColor5, text_size=size.small)

    table.cell(debugTable, 0, 5, "DXY 15m", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 5, str.tostring(dxyClose15, "#.###") + "\n" + dxyLabel15, text_color=dxyColor15, text_size=size.small)

    table.cell(debugTable, 0, 6, "Gold 1m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 6, str.tostring(goldClose1, "#.##") + "\n" + goldLabel1, text_color=goldColor1, text_size=size.small)

    table.cell(debugTable, 0, 7, "Gold 5m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 7, str.tostring(goldClose5, "#.##") + "\n" + goldLabel5, text_color=goldColor5, text_size=size.small)

    table.cell(debugTable, 0, 8, "Gold 15m", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 1, 8, str.tostring(goldClose15, "#.##") + "\n" + goldLabel15, text_color=goldColor15, text_size=size.small)

    table.cell(debugTable, 2, 0, "", bgcolor=color.new(color.black, 0))

    table.cell(debugTable, 3, 0, "EUR Current",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 0, str.tostring(eurusdCurrent, "#.#####"), text_color=color.aqua, text_size=size.small)

    table.cell(debugTable, 3, 1, "DXY Current",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 1, str.tostring(dxyCurrent, "#.###"), text_color=color.aqua, text_size=size.small)

    table.cell(debugTable, 3, 2, "Gold Current", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 2, str.tostring(goldCurrent, "#.##"), text_color=color.aqua, text_size=size.small)

    table.cell(debugTable, 3, 3, "State", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 3, stateText, text_color=stateColor, text_size=size.small)

    table.cell(debugTable, 3, 4, "RSI 1m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 4, rsi1Text, text_color=rsi1Color, text_size=size.small)

    table.cell(debugTable, 3, 5, "RSI 5m",  text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 5, rsi5Text, text_color=rsi5Color, text_size=size.small)

    table.cell(debugTable, 3, 6, "RSI 15m", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 6, rsi15Text, text_color=rsi15Color, text_size=size.small)

    table.cell(debugTable, 3, 7, "RSI Avg", text_color=color.white, text_size=size.small)
    table.cell(debugTable, 4, 7, rsiAvgText, text_color=rsiAvgColor, text_size=size.small)
This panel shows reference data only — it does not include GoldScan's own entry-signal logic, which stays private to the app.