OPEN-SOURCE SCRIPT
Playbook

//version=6
indicator('Playbook', overlay = true, scale = scale.right)
// === Inputs ===
useYesterdayPOC = input.bool(true, 'Use Yesterday\'s POC (else Today’s Developing)')
atrLength = input.int(14, 'ATR Length', minval = 1)
stretchMult = input.float(1.5, 'Stretch Threshold (in ATRs)', minval = 0.1, step = 0.1)
showBands = input.bool(true, "Show Stretch Bands")
useAnchoredVWAP = input.bool(true, "Show Anchored VWAP")
anchorDate = input.time(timestamp("01 Jan 2023 00:00 +0000"), "VWAP Anchor Date")
// === ATR ===
atr = ta.atr(atrLength)
isNewDay = ta.change(time('D')) != 0
// === VWAP as POC Approximation ===
todayVWAP = ta.vwap
var float yVWAP = na
if isNewDay
yVWAP := todayVWAP[1]
activePOC = useYesterdayPOC and not na(yVWAP) ? yVWAP : todayVWAP
// === Stretch Bands ===
upperBand = activePOC + atr * stretchMult
lowerBand = activePOC - atr * stretchMult
// Plot stretch bands
pocColor = color.yellow
bandFill = plot(upperBand, "Upper Band", color=color.red, linewidth=1, display=showBands ? display.all : display.none)
bandFill2 = plot(lowerBand, "Lower Band", color=color.green, linewidth=1, display=showBands ? display.all : display.none)
pocLine = plot(activePOC, "POC Target", color=pocColor, linewidth=2)
fill(bandFill, bandFill2, color=color.new(color.gray, 90))
// === Anchored VWAP ===
anchoredVWAP = ta.vwap(ta.change(time) >= anchorDate ? close : na)
plot(useAnchoredVWAP ? anchoredVWAP : na, "Anchored VWAP", color=color.blue, linewidth=2)
// === STATUS TABLE ===
var table statusTable = table.new(position.bottom_right, 1, 1, border_width=1, border_color=color.gray)
insideBands = close <= upperBand and close >= lowerBand
statusText = insideBands ? "WAIT" : "TRADE AVAILABLE"
statusColor = insideBands ? color.orange : color.green
table.cell(statusTable, 0, 0, statusText, text_color=color.rgb(5, 4, 4), bgcolor=statusColor)
// === Heatmap ===
bgcolor(close > upperBand ? color.new(color.red, 80) : close < lowerBand ? color.new(color.green, 80) : color.new(color.orange, 90))
indicator('Playbook', overlay = true, scale = scale.right)
// === Inputs ===
useYesterdayPOC = input.bool(true, 'Use Yesterday\'s POC (else Today’s Developing)')
atrLength = input.int(14, 'ATR Length', minval = 1)
stretchMult = input.float(1.5, 'Stretch Threshold (in ATRs)', minval = 0.1, step = 0.1)
showBands = input.bool(true, "Show Stretch Bands")
useAnchoredVWAP = input.bool(true, "Show Anchored VWAP")
anchorDate = input.time(timestamp("01 Jan 2023 00:00 +0000"), "VWAP Anchor Date")
// === ATR ===
atr = ta.atr(atrLength)
isNewDay = ta.change(time('D')) != 0
// === VWAP as POC Approximation ===
todayVWAP = ta.vwap
var float yVWAP = na
if isNewDay
yVWAP := todayVWAP[1]
activePOC = useYesterdayPOC and not na(yVWAP) ? yVWAP : todayVWAP
// === Stretch Bands ===
upperBand = activePOC + atr * stretchMult
lowerBand = activePOC - atr * stretchMult
// Plot stretch bands
pocColor = color.yellow
bandFill = plot(upperBand, "Upper Band", color=color.red, linewidth=1, display=showBands ? display.all : display.none)
bandFill2 = plot(lowerBand, "Lower Band", color=color.green, linewidth=1, display=showBands ? display.all : display.none)
pocLine = plot(activePOC, "POC Target", color=pocColor, linewidth=2)
fill(bandFill, bandFill2, color=color.new(color.gray, 90))
// === Anchored VWAP ===
anchoredVWAP = ta.vwap(ta.change(time) >= anchorDate ? close : na)
plot(useAnchoredVWAP ? anchoredVWAP : na, "Anchored VWAP", color=color.blue, linewidth=2)
// === STATUS TABLE ===
var table statusTable = table.new(position.bottom_right, 1, 1, border_width=1, border_color=color.gray)
insideBands = close <= upperBand and close >= lowerBand
statusText = insideBands ? "WAIT" : "TRADE AVAILABLE"
statusColor = insideBands ? color.orange : color.green
table.cell(statusTable, 0, 0, statusText, text_color=color.rgb(5, 4, 4), bgcolor=statusColor)
// === Heatmap ===
bgcolor(close > upperBand ? color.new(color.red, 80) : close < lowerBand ? color.new(color.green, 80) : color.new(color.orange, 90))
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.