InvestorsHub Logo
Followers 4
Posts 788
Boards Moderated 0
Alias Born 04/25/2019

Re: None

Tuesday, 06/04/2024 3:49:08 PM

Tuesday, June 04, 2024 3:49:08 PM

Post# of 3636
A nice code for Volume Labels

================================== code starts below
#volume labels

def VolumeDeviation_Length = 60;
def VolumeDeviate = 2;
def volumestdevlength = RelativeVolumeStDev(length = volumeDeviation_Length);
def abovedev = volumestdevlength >= volumeDeviate;
def belowdev = volumestdevlength <= volumeDeviate;

def volumeincrease = volume > volume[1];
def volumedevincrease = volumeincrease and abovedev;
def volumedecrease = volume < volume[1];
def volumedevdecrease = volumedecrease and abovedev;

def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def volumeBuying = V * (C - L) / (H - L);
def volumeSelling = V * (H - C) / (H - L);

input Show_Labels = yes;
AddLabel(Show_Labels, "Buy Vol = "+Round(volumeBuying, 0), if volumeBuying > volumeSelling then color.White else color.Dark_ORANGE);#changed from Red
#AddLabel(Show_Labels, "Sell Vol = "+Round(volumeSelling, 0), if volumeSelling > volumeBuying then color.White else color.Dark_ORANGE);#changed from Red
AddLabel(Show_Labels, "Sell Vol = "+Round(volumeSelling, 0), if volumeSelling > volumeBuying then color.YELLOW else color.Dark_ORANGE);#changed from Red

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.