OPEN-SOURCE SCRIPT
Anchored VWAP + Bands + Signals

//version=5
indicator("Anchored VWAP + Bands + Signals", overlay=true)
// ===== INPUTS =====
anchorTime = input.time(timestamp("2025-12-02 00:00"), "Anchor Date/Time")
std1 = input.float(1.0, "±1σ Band")
std2 = input.float(2.0, "±2σ Band")
// ===== VWAP CALCULATION =====
var float cumPV = 0.0
var float cumVol = 0.0
if time >= anchorTime
cumPV += close * volume
cumVol += volume
vwap = cumVol != 0 ? cumPV / cumVol : na
// ===== STANDARD DEVIATION =====
barsSinceAnchor = bar_index - ta.valuewhen(time >= anchorTime, bar_index, 0)
sd = barsSinceAnchor > 1 ? ta.stdev(close, barsSinceAnchor) : 0
// ===== BANDS =====
upper1 = vwap + std1 * sd
lower1 = vwap - std1 * sd
upper2 = vwap + std2 * sd
lower2 = vwap - std2 * sd
plot(vwap, color=color.orange, title="VWAP")
plot(upper1, color=color.green, title="+1σ Band")
plot(lower1, color=color.green, title="-1σ Band")
plot(upper2, color=color.red, title="+2σ Band")
plot(lower2, color=color.red, title="-2σ Band")
// ===== SIGNALS =====
buySignal = ta.crossover(close, lower1)
sellSignal = ta.crossunder(close, upper1)
plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")
alertcondition(buySignal, title="Buy Alert", message="Price touched lower 1σ band – Buy Opportunity")
alertcondition(sellSignal, title="Sell Alert", message="Price touched upper 1σ band – Sell Opportunity")
indicator("Anchored VWAP + Bands + Signals", overlay=true)
// ===== INPUTS =====
anchorTime = input.time(timestamp("2025-12-02 00:00"), "Anchor Date/Time")
std1 = input.float(1.0, "±1σ Band")
std2 = input.float(2.0, "±2σ Band")
// ===== VWAP CALCULATION =====
var float cumPV = 0.0
var float cumVol = 0.0
if time >= anchorTime
cumPV += close * volume
cumVol += volume
vwap = cumVol != 0 ? cumPV / cumVol : na
// ===== STANDARD DEVIATION =====
barsSinceAnchor = bar_index - ta.valuewhen(time >= anchorTime, bar_index, 0)
sd = barsSinceAnchor > 1 ? ta.stdev(close, barsSinceAnchor) : 0
// ===== BANDS =====
upper1 = vwap + std1 * sd
lower1 = vwap - std1 * sd
upper2 = vwap + std2 * sd
lower2 = vwap - std2 * sd
plot(vwap, color=color.orange, title="VWAP")
plot(upper1, color=color.green, title="+1σ Band")
plot(lower1, color=color.green, title="-1σ Band")
plot(upper2, color=color.red, title="+2σ Band")
plot(lower2, color=color.red, title="-2σ Band")
// ===== SIGNALS =====
buySignal = ta.crossover(close, lower1)
sellSignal = ta.crossunder(close, upper1)
plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")
alertcondition(buySignal, title="Buy Alert", message="Price touched lower 1σ band – Buy Opportunity")
alertcondition(sellSignal, title="Sell Alert", message="Price touched upper 1σ band – Sell Opportunity")
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.