OG Bubba Knox
New member
Hello!
Apologies if this has been asked before, but I have a some code that I want to display the % of volume in the most recent EXT vs the average total daily volume. I can easily get this code to work if I want to output it to a chart, HOWEVER the issue arises when I try to add this script to a watchlist. When itruns in the watchlist it will output a completely random number.
Apologies if this has been asked before, but I have a some code that I want to display the % of volume in the most recent EXT vs the average total daily volume. I can easily get this code to work if I want to output it to a chart, HOWEVER the issue arises when I try to add this script to a watchlist. When itruns in the watchlist it will output a completely random number.
Code:
#declare on_volume;
def length = 30;
def VolDayAvg = (fold index = 1 to length + 1 with Avg = 0 do (Avg + volume(period = "DAY")[index])) / length;
def PrestartTime = 0400;
def PreendTime = 0929;
def PreMkt = SecondsFromTime(PrestartTime) >= 0 and SecondsTillTime(PreendTime) >= 0;
def PreVolMins = if PreMkt and !PreMkt[1] then volume
else if PreMkt then PreVolMins[1] + volume
else PreVolMins[1];
def PoststartTime = 1630;
def PostendTime = 1959;
def PostMkt = SecondsFromTime(PoststartTime) >= 0 and SecondsTillTime(PostendTime) >= 0;
def PostVolMins = if PostMkt and !PostMkt[1] then volume
else if PostMkt then PostVolMins[1] + volume
else PostVolMins[1];
def AH_Vol = PreVolMins + PostVolMins;
def Mult = 100 * AH_Vol / VolDayAvg;
plot PM_Volume_Multiplier = Mult;
PM_Volume_Multiplier.AssignValueColor(color.white);