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 de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
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.
Script de código abierto
Siguiendo fielmente el espíritu de TradingView, el creador de este script lo ha publicado en código abierto, permitiendo que otros traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Puede utilizarlo de forma gratuita, pero tenga en cuenta que la publicación de este código está sujeta a nuestras Normas internas.
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.