Hi, need help with 1) finding volume traded for the first 5minutes after open for today and 2)the average of this volume for the past 20 days.
I was able to find 1) briefly through
def start = SecondsFromTime(0930);
def end = SecondsTillTime(0935);
def first5min = if start >=0 and end >0 then 1 else 0;
def vol = if first5min and !first5min[1] then volume else if first5min then vol[1]+volume else vol[1];
Now I am stuck on 2) and not sure how to go about finding the volume of first 5min traded for yesterday and that of the day before yesterday..etc to take the average of this 5min volume traded for the past 20 days. Please help.
I was able to find 1) briefly through
def start = SecondsFromTime(0930);
def end = SecondsTillTime(0935);
def first5min = if start >=0 and end >0 then 1 else 0;
def vol = if first5min and !first5min[1] then volume else if first5min then vol[1]+volume else vol[1];
Now I am stuck on 2) and not sure how to go about finding the volume of first 5min traded for yesterday and that of the day before yesterday..etc to take the average of this 5min volume traded for the past 20 days. Please help.