0% found this document useful (0 votes)
108 views7 pages

Cumlative Vvap

Uploaded by

originspica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views7 pages

Cumlative Vvap

Uploaded by

originspica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

//@version=5

indicator("POCO", overlay=true)

// ==============================
// SETTINGS
// ==============================
// Inputs for toggling indicators
showRSI = input.bool(true, title="Show RSI")
showQQE = input.bool(true, title="Show QQE")
showVWAP = input.bool(true, title="Show VWAP")
showBollinger = input.bool(true, title="Show Bollinger Bands")
showMACD = input.bool(true, title="Show MACD")
showTSI = input.bool(true, title="Show TSI")
showMarketProfile = input.bool(true, title="Show Market Profile")
showSupportResistance = input.bool(true, title="Show Dynamic
Support/Resistance")
showHyperWave = input.bool(true, title="Show Hyper Wave")
showHyperwaveofcumulativeVWAP=input.bool(true, title="Show Hyperwave of
Cumulative VWAP")
showSubHyperWaveExtended = input.bool(false, title="Show Sub Hyper Wave
Extended")

// RSI Inputs
rsiLen = input.int(14, "RSI Length")
smoothRSI = input.int(5, "RSI Smoothing")
rsiOB = input.int(70, title="RSI Overbought Level")
rsiOS = input.int(30, title="RSI Oversold Level")
rsiColor = input.color(color.purple, title="RSI Color")

// QQE Inputs
qqeFactor = input.float(4.238, "Fast QQE Factor")
threshold = input.float(10, "Threshold")

// VWAP Inputs
vwapColor = input.color(color.blue, title="VWAP Color")
vwapWidth = input.int(2, title="VWAP Line Width")

// Bollinger Bands Inputs


bollLength = input.int(20, title="Bollinger Bands Length")
bollMultiplier = input.float(2.0, title="Bollinger Bands Multiplier")
bollColor = input.color(color.blue, title="Bands Color")

// MACD Inputs
macdShortLength = input.int(12, title="MACD Short Length")
macdLongLength = input.int(26, title="MACD Long Length")
macdSignalLength = input.int(9, title="MACD Signal Smoothing")
macdColor = input.color(color.yellow, title="MACD Color")

// TSI Inputs
tsiLength1 = input.int(25, title="TSI Length 1")
tsiLength2 = input.int(13, title="TSI Length 2")
tsiColor = input.color(color.orange, title="TSI Color")
// Market Profile Inputs
profileLength = input.int(50, title="Market Profile Length")
profileColor = input.color(color.red, title="Market Profile Color")

// Dynamic Support/Resistance Inputs


supportColor = input.color(color.green, title="Support Color")
resistanceColor = input.color(color.red, title="Resistance Color")
enableCloseSupportResistance = input.bool(true, title="Enable
Close/Tight Support/Resistance")
ClosesupportColor = input.color(color.green, title="Close/Tight Support
Color")
CloseresistanceColor = input.color(color.red, title="Close/Tight
Resistance Color")

// Input settings for Hyper Wave


hwLength = input.int(20, title="Hyper Wave Length")
hwColorUp = input.color(color.green, title="Hyper Wave Rising Color")
hwColorDown = input.color(color.red, title="Hyper Wave Falling Color")
hwColorNeutral = input.color(color.gray, title="Hyper Wave Neutral
Color")

// Input settings for Sub Hyper Wave


subHwLength = input.int(10, title="Sub Hyper Wave Length")
subHwSource = input.string("open", title="Sub Hyper Wave Source",
options=["open", "high", "low", "close"])
subHwColorUp = input.color(color.blue, title="Sub Hyper Wave Rising
Color")
subHwColorDown = input.color(color.orange, title="Sub Hyper Wave Falling
Color")
subHwColorNeutral = input.color(color.purple, title="Sub Hyper Wave
Neutral Color")

// Input settings for Sub Hyper Wave Extended


subHwExtendedEnabled = input.bool(false, title="Enable Sub Hyper Wave
Extended")
subHwExtendedLength = input.int(10, title="Sub Hyper Wave Extended
Length")
showOpen = input.bool(true, title="Show Extended Wave Open")
showHigh = input.bool(true, title="Show Extended Wave High")
showLow = input.bool(true, title="Show Extended Wave Low")
showClose = input.bool(true, title="Show Extended Wave Close")
extColorOpen = input.color(color.yellow, title="Extended Wave Open
Color")
extColorHigh = input.color(color.orange, title="Extended Wave High
Color")
extColorLow = input.color(color.purple, title="Extended Wave Low Color")
extColorClose = input.color(color.blue, title="Extended Wave Close
Color")

// ==============================
// FUNCTION DEFINITIONS
// ==============================
// MA Function
ma(type, src, len) =>
float result = na
if type == "SMA"
result := ta.sma(src, len)
if type == "EMA"
result := ta.ema(src, len)
if type == "DEMA"
e = ta.ema(src, len)
result := 2 * e - ta.ema(e, len)
if type == "TEMA"
e = ta.ema(src, len)
result := 3 * (e - ta.ema(e, len)) + ta.ema(ta.ema(e, len), len)
if type == "WMA"
result := ta.wma(src, len)
if type == "VWMA"
result := ta.vwma(src, len)
if type == "SMMA"
w = ta.wma(src, len)
result := na(w[1]) ? ta.sma(src, len) : (w[1] * (len - 1) + src)
/ len
if type == "HMA"
result := ta.wma(2 * ta.wma(src, len / 2) - ta.wma(src, len),
math.round(math.sqrt(len)))
if type == "LSMA"
result := ta.linreg(src, len, 0)
if type == "ALMA"
result := ta.alma(src, len, 0.85, 6)
if type == "PEMA"
ema1 = ta.ema(src, len)
ema2 = ta.ema(ema1, len)
ema3 = ta.ema(ema2, len)
ema4 = ta.ema(ema3, len)
ema5 = ta.ema(ema4, len)
ema6 = ta.ema(ema5, len)
ema7 = ta.ema(ema6, len)
ema8 = ta.ema(ema7, len)
pema = 8 * ema1 - 28 * ema2 + 56 * ema3 - 70 * ema4 + 56 * ema5
- 28 * ema6 + 8 * ema7 - ema8
result := pema
result

// ==============================
// RSI CALCULATION
// ==============================
src = input(close, title="RSI Source")
rsi = ta.rsi(src, rsiLen)
rsiMa = ma("EMA", rsi, smoothRSI)
atrRsi = math.abs(rsiMa[1] - rsiMa)
maAtrRsi = ma("EMA", atrRsi, rsiLen * 2 - 1)
dar = ma("EMA", maAtrRsi, rsiLen * 2 - 1) * qqeFactor

// ==============================
// QQE CALCULATION
// ==============================
var float longband = na
var float shortband = na
trend = 0

DeltaFastAtrRsi = dar
RSIndex = rsiMa
newshortband = RSIndex + DeltaFastAtrRsi
newlongband = RSIndex - DeltaFastAtrRsi
longband := RSIndex[1] > longband[1] and RSIndex > longband[1] ?
math.max(longband[1], newlongband) : newlongband
shortband := RSIndex[1] < shortband[1] and RSIndex < shortband[1] ?
math.min(shortband[1], newshortband) : newshortband
cross_1 = ta.cross(longband[1], RSIndex)
trend := ta.cross(RSIndex, shortband[1]) ? 1 : cross_1 ? -1 :
nz(trend[1], 1)
FastAtrRsiTL = trend == 1 ? longband : shortband

// QQE Signals
QQExlong = 0
QQExshort = 0
QQEzlong = 0
QQEzshort = 0
QQEclong = 0
QQEcshort = 0

QQExlong := showQQE and FastAtrRsiTL < RSIndex ? QQExlong + 1 : 0


QQExshort := showQQE and FastAtrRsiTL > RSIndex ? QQExshort + 1 : 0
QQEzlong := showQQE and RSIndex >= 50 ? QQEzlong + 1 : 0
QQEzshort := showQQE and RSIndex <= 50 ? QQEzshort + 1 : 0
QQEclong := showQQE and QQExlong > 0 ? QQEclong + 1 : 0
QQEcshort := showQQE and QQExshort > 0 ? QQEcshort + 1 : 0

// ==============================
// VWAP CALCULATION
// ==============================
var float vwapSum = na
var float vwap = na
var float volumeSum = na
var float Cumulativevwap = na
vwapSum := na(vwapSum[1]) ? (close * volume) : (vwapSum[1] + close *
volume)
vwap := vwapSum / math.sum(volume, 1) // This line should be updated to
handle cumulative sum correctly.var float vwapSum = na

// Update cumulative sums


vwapSum := na(vwapSum[1]) ? (close * volume) : (vwapSum[1] + close *
volume)
volumeSum := na(volumeSum[1]) ? volume : (volumeSum[1] + volume)

// Calculate CVWAP
Cumulativevwap := vwapSum / volumeSum

// Hyper wave of cumulative VWAP


CumulativevwaphwUp = ta.linreg(Cumulativevwap, hwLength, 0) + (hwLength
/ 2)
CumulativevwaphwDown = ta.linreg(Cumulativevwap, hwLength, 0) -
(hwLength / 2)

// Plot Hyper wave of cumulative VWAP


plot(showHyperWave ? CumulativevwaphwUp : na, title="Hyper Wave Up",
color=CumulativehwColorUp, linewidth=2)
plot(showHyperWave ? CumulativevwaphwDown : na, title="Hyper Wave Down",
color=CumulativehwColorDown, linewidth=2)

// ==============================
// BOLLINGER BANDS CALCULATION
// ==============================
basis = ta.sma(close, bollLength)
dev = bollMultiplier * ta.stdev(close, bollLength)
upper = basis + dev
lower = basis - dev

// ==============================
// MACD CALCULATION
// ==============================
[macdLine, signalLine, _] = ta.macd(close, macdShortLength,
macdLongLength, macdSignalLength)
macdHist = macdLine - signalLine

// ==============================
// TSI CALCULATION
// ==============================
tsi = ta.tsi(close, tsiLength1, tsiLength2)

// ==============================
// MARKET PROFILE CALCULATION
// ==============================
var float highestPrice = na
var float lowestPrice = na
highestPrice := na(highestPrice[1]) ? high : math.max(highestPrice[1],
high)
lowestPrice := na(lowestPrice[1]) ? low : math.min(lowestPrice[1], low)

// ==============================
// SUPPORT/RESISTANCE CALCULATION
// ==============================
var float support = na
var float resistance = na
support := ta.valuewhen(close[1] < close, low, 0)
resistance := ta.valuewhen(close[1] > close, high, 0)

// ==============================
// HYPER WAVE CALCULATION
// ==============================
hwUp = ta.linreg(close, hwLength, 0) + (hwLength / 2)
hwDown = ta.linreg(close, hwLength, 0) - (hwLength / 2)

// ==============================
// SUB HYPER WAVE CALCULATION
// ==============================
subHwUp = ta.linreg(close, subHwLength, 0) + (subHwLength / 2)
subHwDown = ta.linreg(close, subHwLength, 0) - (subHwLength / 2)

// ==============================
// PLOTTING
// ==============================
// Plot RSI
plot(showRSI ? rsi : na, title="RSI", color=rsiColor, linewidth=2)
hline(rsiOB, "RSI Overbought Level", color=color.red)
hline(rsiOS, "RSI Oversold Level", color=color.green)

// Plot QQE
plot(showQQE ? FastAtrRsiTL : na, title="QQE Trend", color=color.blue,
linewidth=2)

// Plot VWAP
plot(showVWAP ? vwap : na, title="VWAP", color=vwapColor,
linewidth=vwapWidth)

// Plot Bollinger Bands


plot(showBollinger ? upper : na, title="Upper Bollinger Band",
color=color.red)
plot(showBollinger ? lower : na, title="Lower Bollinger Band",
color=color.green)
plot(showBollinger ? basis : na, title="Bollinger Basis",
color=color.blue)

// Plot MACD
plot(showMACD ? macdLine : na, title="MACD Line", color=color.yellow)
plot(showMACD ? signalLine : na, title="Signal Line",
color=color.orange)
plot(showMACD ? macdHist : na, title="MACD Histogram",
color=color.green, style=plot.style_histogram)

// Plot TSI
plot(showTSI ? tsi : na, title="TSI", color=tsiColor, linewidth=2)

// Plot Market Profile


plot(showMarketProfile ? highestPrice : na, title="Market Profile High",
color=color.red)
plot(showMarketProfile ? lowestPrice : na, title="Market Profile Low",
color=color.green)

// Plot Support/Resistance
plot(showSupportResistance ? support : na, title="Support",
color=supportColor)
plot(showSupportResistance ? resistance : na, title="Resistance",
color=resistanceColor)

// Plot Hyper Wave


plot(showHyperWave ? hwUp : na, title="Hyper Wave Up", color=hwColorUp,
linewidth=2)
plot(showHyperWave ? hwDown : na, title="Hyper Wave Down",
color=hwColorDown, linewidth=2)

// Plot Sub Hyper Wave


plot(showSubHyperWaveExtended ? subHwUp : na, title="Sub Hyper Wave Up",
color=subHwColorUp, linewidth=2)
plot(showSubHyperWaveExtended ? subHwDown : na, title="Sub Hyper Wave
Down", color=subHwColorDown, linewidth=2)

You might also like