I had copied this script a couple years ago and it was working fine in ToS. The daily volume would match the volume in my watchlist. The calculation for the 50 day average volume was correct. Now the daily volume doesn't match the daily volume in the ToS watchlist. In the image below the daily volume is off by 263,800,014. The daily volume is extremely off for every stock in the watchlist and my other watchlists. Here is the script that I have been using and only notice this volume being off on Friday, 10/18/24.
Does anyone see any error in the script below or do you have another script that will show the volume for Buyers and Sellers?
Thanks in Advance,
Mark
plot Data = close;
declare lower;
declare zerobase;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
#Replace the two lines below to accommodate unfilled gaps
#def Selling = V * (H - C) / (H - L);
#def Buying = V * (C - L) / (H - L);
# Unfilled Gap down: Use prior close as high
def equivHi = if H < C[1] then C[1] else H;
# Unfilled Gap up: Use prior close as low
def equivLo = if L > C[1] then C[1] else L;
def Buying = Round(V * (C - equivLo) / (equivHi - equivLo), 0);
def Selling = Round(V * (equivHi - C) / (equivHi - equivLo), 0);
# Selling Volume
plot SV = Selling;
SV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SV.SetDefaultColor(CreateColor(255, 0, 0)); #Red
SV.SetLineWeight(1);
#SV.hide();
# Buying Volume
plot BV = Buying;
BV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BV.SetDefaultColor(CreateColor(0, 255, 0));
BV.SetLineWeight(5);
#BV.hide()
Does anyone see any error in the script below or do you have another script that will show the volume for Buyers and Sellers?
Thanks in Advance,
Mark
plot Data = close;
declare lower;
declare zerobase;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
#Replace the two lines below to accommodate unfilled gaps
#def Selling = V * (H - C) / (H - L);
#def Buying = V * (C - L) / (H - L);
# Unfilled Gap down: Use prior close as high
def equivHi = if H < C[1] then C[1] else H;
# Unfilled Gap up: Use prior close as low
def equivLo = if L > C[1] then C[1] else L;
def Buying = Round(V * (C - equivLo) / (equivHi - equivLo), 0);
def Selling = Round(V * (equivHi - C) / (equivHi - equivLo), 0);
# Selling Volume
plot SV = Selling;
SV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
SV.SetDefaultColor(CreateColor(255, 0, 0)); #Red
SV.SetLineWeight(1);
#SV.hide();
# Buying Volume
plot BV = Buying;
BV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
BV.SetDefaultColor(CreateColor(0, 255, 0));
BV.SetLineWeight(5);
#BV.hide()