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))
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.