Knowing the percentage of buyers and sellers in the market is a powerful tool for making informed investment decisions. By using this script, traders can assess the market sentiment and determine whether there is a high demand for a particular stock, or if there are more sellers than buyers. This information can help traders to time their trades more effectively, as well as to identify potential trends or market reversals. The buyPercent and sellPercent variables calculate the percentage of buying and selling volume, respectively, in relation to the total trading volume. These percentages are displayed in the labels, along with the current buying and selling volumes. The labels are color-coded to indicate whether there is more buying or selling pressure in the market, with green indicating more buying and red indicating more selling.
(Added Current bar volume and last bar volume.) 5-06-2023
Video:
Install: Go to Studies, Edit Studies, Create, Delete whats in there, copy the code below, paste it, Name it, Move it over to the chart if not already there.
Code:
#hint: Buy_Sell_Percent_Label - Created by @uptwobucks . This Volume Label measures the percentage of buys and sells live. Wait for the buys to outnumber the sells (Turns Green) then make your decision.
declare upper;
input Show_Labels = yes;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
def OL = open[1];
def HL = high[1];
def CL = close[1];
def LL = low[1];
def VL = volume[1];
def LBuying = VL * (CL - LL) / (HL - LL);
def LSelling = VL * (HL - CL) / (HL - LL);
def totVol = Round(Buying, 0) + Round(Selling, 0) ;
def buyPercent = ( Round(Buying, 0) / totVol ) * 100;
def sellPercent = ( Round(Selling, 0) / totVol ) * 100;
AddLabel(Show_Labels, "Total Vol: " + volume(period = AggregationPeriod.DAY), Color.WHITE);
#Volume of Current Bar
AddLabel(yes, "CurrentBar Vol: " + volume, Color.LIGHT_GREEN);
#Volume of the Last Bar
AddLabel(yes, "LastBar Vol: " + volume[1], Color.LIGHT_ORANGE);
AddLabel(Show_Labels, " BUYERS: " + Round(Buying, 0) + " -- " + Round(buyPercent, 0) + "%" , if Buying > Selling then Color.LIGHT_GREEN else Color.BLACK);
AddLabel(Show_Labels, " SELLERS: " + Round(Selling, 0) + " -- " + Round(sellPercent, 0) + "%" , if Selling > Buying then Color.LIGHT_RED else Color.BLACK);
[B][B][B][B][B]End[/B][/B][/B][/B][/B]