Plot only above Avg Vol

Ictheeuss

New member
Hello everyone,

I was wondering if someone can please help me with this code. What I'm trying to achieve is for a histogram plot of only volume bars that are above average volume. Here is what I came up with, but nothing plots. I'm very new to this, so any help would be much appreciated. Thanks.

Code:
declare lower;
declare zerobase;
input length = 50;

plot Vol = volume;

plot VolAvg = Average(volume, length);

plot AboveAvgVol = Vol>VolAvg;

AboveAvgVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

AboveAvgVol.SetLineWeight(3);

AboveAvgVol.DefineColor("Up", Color.UPTICK);

AboveAvgVol.DefineColor("Down", Color.DOWNTICK);

AboveAvgVol.AssignValueColor(if close > close[1] then Vol.color("Up") else if close < close[1] then AboveAvgVol.color("Down") else GetColor(1));

VolAvg.SetDefaultColor(GetColor(8));
 

generic

Active member
@Ictheeuss
Code:
declare lower;
input length = 50;

def Vol = volume;

plot VolAvg = Average(volume, length);

plot AboveAvgVol = if Vol>VolAvg then Vol else Double.NaN;

AboveAvgVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

AboveAvgVol.SetLineWeight(3);

AboveAvgVol.DefineColor("Up", Color.UPTICK);

AboveAvgVol.DefineColor("Down", Color.DOWNTICK);

AboveAvgVol.AssignValueColor(if close > close[1] then AboveAvgVol.color("Up") else if close < close[1] then AboveAvgVol.color("Down") else GetColor(1));
 

Ictheeuss

New member
@Ictheeuss
Code:
declare lower;
input length = 50;

def Vol = volume;

plot VolAvg = Average(volume, length);

plot AboveAvgVol = if Vol>VolAvg then Vol else Double.NaN;

AboveAvgVol.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

AboveAvgVol.SetLineWeight(3);

AboveAvgVol.DefineColor("Up", Color.UPTICK);

AboveAvgVol.DefineColor("Down", Color.DOWNTICK);

AboveAvgVol.AssignValueColor(if close > close[1] then AboveAvgVol.color("Up") else if close < close[1] then AboveAvgVol.color("Down") else GetColor(1));
Thank you for the help!! Much appreciated
 

Similar threads

Top