OPEN-SOURCE SCRIPT

Vwap and Super Trend by Trade Partners

//version=5
indicator(title='Vwap and Super Trend by Trade Partners', shorttitle='Suresh', overlay=true)
ha_t = syminfo.ticker
// Credits goes to Options scalping
// === VWAP ===
_isVWAP = input(true, '─────── Enable VWAP ─────')
src = input(title='Source', defval=hlc3)
t = time('D')
start = na(t[1]) or t > t[1]

sumSrc = src * volume
sumVol = volume
sumSrc := start ? sumSrc : sumSrc + sumSrc[1]
sumVol := start ? sumVol : sumVol + sumVol[1]

// You can use built-in vwap() function instead.

plot(_isVWAP ? sumSrc / sumVol : na, title='VWAP', color=color.new(color.red, 0), linewidth=2)

// === SuperTrend ===
_isSuperTrend = input(true, '─────── Enable SuperTrend ─────')
Factor = input.int(2, minval=1, maxval=100)
Pd = input.int(10, minval=1, maxval=100)

Up = hl2 - Factor * ta.atr(Pd)
Dn = hl2 + Factor * ta.atr(Pd)

Trend = 0.0
TrendUp = 0.0
TrendDown = 0.0
TrendUp := close[1] > TrendUp[1] ? math.max(Up, TrendUp[1]) : Up
TrendDown := close[1] < TrendDown[1] ? math.min(Dn, TrendDown[1]) : Dn

Trend := close > TrendDown[1] ? 1 : close < TrendUp[1] ? -1 : nz(Trend[1], 1)
Tsl = Trend == 1 ? TrendUp : TrendDown

linecolor = Trend == 1 ? color.green : color.red

plot(_isSuperTrend ? Tsl : na, color=linecolor, style=plot.style_line, linewidth=2, title='SuperTrend', transp=1)

// === Parabolic SAR ===
_isPSAR = input(true, '──── Enable Parabolic SAR ─────')

start1 = input(0.02)
increment = input(0.02)
maximum = input(0.2)
out = ta.sar(start1, increment, maximum)
plot(_isPSAR ? out : na, title='PSAR', style=plot.style_cross, color=color.new(color.black, 0))

// === 20 VWMA ===
_isVWMA = input(true, '──── Enable 20 VWMA ─────')
plot(_isVWMA ? ta.vwma(close, 20) : na, title='VWMA', style=plot.style_line, color=color.new(color.blue, 0))

// === Strong Volume ===
ShowHighVolume = input(true, '──── Enable High Volume Indicator ─────')
Averageval = input.int(title='Average Volume: (in K)', defval=50, minval=1)
Averageval *= 1000
varstrong = ShowHighVolume ? volume > Averageval : false
plotshape(varstrong, style=shape.square, location=location.bottom, color=color.new(color.blue, 0))
Bands and ChannelsCandlestick analysisChart patterns

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer