Cumlative Vvap
Cumlative Vvap
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")
// 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")
// ==============================
// 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
// ==============================
// 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
// Calculate CVWAP
Cumulativevwap := vwapSum / volumeSum
// ==============================
// 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 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 Support/Resistance
plot(showSupportResistance ? support : na, title="Support",
color=supportColor)
plot(showSupportResistance ? resistance : na, title="Resistance",
color=resistanceColor)