Author Message:
Financial Volume is the quantity of a certain asset traded multiplied by its price. In other others, it's the amount of money traded for that particular asset.
TradingView & TOS uses the "quantity" volume as standard (for a good reason) and actually there is no "right" volume but the quantity volume alone might give the wrong idea.
Samer800 - I added VWAP cloud to identify the increase on Volume. pls note that Volume bar color vary from the original volume indicator. More over, I added price bar color on the increased volume.
CODE:
CSS:
#// This source code is subject to the terms of the Mozilla Public License 2.0
#https://www.tradingview.com/script/wkuZN4TJ/
#indicator("Financial Volume with VWAP cloud")
# Created and mod by Sam4Cok@Samer800 based on @f1l1per. code - 11/2022
declare lower;
input BarColor = yes; # 'Barcolor'
input Source = hlc3;
input showVwapCloud = yes;
input VwapTimeFrame = {default DAY,WEEK, MONTH};
input ShowMA_Line = yes;
input MA_Period = 30; # "MA Period"
def na = Double.NaN;
def v = volume;
def c = close;
# volVWAP
script VVWAP {
input src = close;
input timeFrame = {DAY, WEEK,default MONTH};
def v = Volume;
def cap = GetAggregationPeriod();
def errorInAggregation =
timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or
timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH;
Assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period");
def yyyyMmDd = GetYYYYMMDD();
def periodIndx;
switch (timeFrame) {
case DAY:
periodIndx = yyyyMmDd;
case WEEK:
periodIndx = Floor((DaysFromDate(First(yyyyMmDd)) + GetDayOfWeek(First(yyyyMmDd))) / 7);
case MONTH:
periodIndx = RoundDown(yyyyMmDd / 100, 0);
}
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes);
def volumeSum;
def volumeVwapSum;
if (isPeriodRolled) {
volumeSum = v;
volumeVwapSum = v * src;
} else {
volumeSum = CompoundValue(1, volumeSum[1] + v, v);
volumeVwapSum = CompoundValue(1, volumeVwapSum[1] + v * src, v * src);
}
def price = volumeVwapSum / volumeSum;
plot return = price;
}
def FV = Source * v;
def Volvwap = if showVwapCloud then VVWAP(FV, VwapTimeFrame) else 0;
#--- MA Line
def MA = SimpleMovingAvg(FV, MA_Period);
plot maLine = ma;
maLine.SetDefaultColor(Color.BLUE);
maLine.SetHiding(!ShowMA_Line);
#--------------------------------------------
plot FinancialVolume = FV;
FinancialVolume.AssignValueColor(if FV > Volvwap then if c>c[1] then CreateColor(50,201,86) else color.RED else Color.GRAY);
FinancialVolume.SetPaintingStrategy(PaintingStrategy.SQUARED_HISTOGRAM);
def VWAP = Volvwap;
#--- Cloud
AddCloud(VWAP, 0, Color.DARK_GRAY);
#--- Bar Color
AssignPriceColor(if !BarColor then Color.CURRENT else
if FV > Volvwap then if c>c[1] then Color.CYAN else color.MAGENTA else Color.CURRENT);
#--- END Clode
Last edited by a moderator: