shankarp2752
New member
@BenTen @SuryaKiranC
Hello, I have created hourly volume study label (Please see below). I would like to add 30 days average volume with same label. Can you please help me?
#HOURLY VOLUME STUDY#
input ShowRTH1HrVol = yes;
input ShowRTH2HrVol = yes;
input ShowRTH3HrVol = yes;
input showRTH4HrVol = yes;
input showRTH5HrVol = yes;
input showRTH6HrVol = yes;
input showRTH7HrVol = yes;
input showRTH8HrVol = yes;
def RTH1HrstartTime = 0930;
input RTH1HrendTime = 1029;
def RTH2HrstartTime = 1030;
input RTH2HrendTime = 1129;
def RTH3HrstartTime = 1130;
input RTH3HrendTime = 1229;
def RTH4HrstartTime = 1230;
input RTH4HrendTime = 1329;
def RTH5HrstartTime = 1330;
input RTH5HrendTime = 1429;
def RTH6HrstartTime = 1430;
input RTH6HrendTime = 1600;
def RTH7HrstartTime = 0400;
input RTH7HrendTime = 0929;
def RTH8HrstartTime = 1601;
input RTH8HrendTime = 2000;
def RTH7Hr = SecondsFromTime(RTH7HrstartTime) >= 0 and SecondsTillTime(RTH7HrendTime) > 0;
def RTH7HrVol = if RTH7Hr and !RTH7Hr[1] then volume else if RTH7Hr then RTH7HrVol[1] + volume else RTH7HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH7HrVol then 0 else 1, "PRE = " + Round(RTH7HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH7Hr == 0 and RTH7Hr[1] == 1 then yes else no, "PRE-MARKET", color = Color.WHITE);
def RTH1Hr = SecondsFromTime(RTH1HrstartTime) >= 0 and SecondsTillTime(RTH1HrendTime) > 0;
def RTH1HrVol = if RTH1Hr and !RTH1Hr[1] then volume else if RTH1Hr then RTH1HrVol[1] + volume else RTH1HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH1HrVol then 0 else 1, "7:30 = " + Round(RTH1HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH1Hr == 0 and RTH1Hr[1] == 1 then yes else no, "07:30", color = Color.WHITE);
def RTH2Hr = SecondsFromTime(RTH2HrstartTime) >= 0 and SecondsTillTime(RTH2HrendTime) > 0;
def RTH2HrVol = if RTH2Hr and !RTH2Hr[1] then volume else if RTH2Hr then RTH2HrVol[1] + volume else RTH2HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH2HrVol then 0 else 1, "8:30 = " + Round(RTH2HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH2Hr == 0 and RTH2Hr[1] == 1 then yes else no, "08:30", color = Color.WHITE);
def RTH3Hr = SecondsFromTime(RTH3HrstartTime) >= 0 and SecondsTillTime(RTH3HrendTime) > 0;
def RTH3HrVol = if RTH3Hr and !RTH3Hr[1] then volume else if RTH3Hr then RTH3HrVol[1] + volume else RTH3HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH3HrVol then 0 else 1, "9:30 = " + Round(RTH3HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH3Hr == 0 and RTH3Hr[1] == 1 then yes else no, "09:30", color = Color.WHITE);
def RTH4Hr = SecondsFromTime(RTH4HrstartTime) >= 0 and SecondsTillTime(RTH4HrendTime) > 0;
def RTH4HrVol = if RTH4Hr and !RTH4Hr[1] then volume else if RTH4Hr then RTH4HrVol[1] + volume else RTH4HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH4HrVol then 0 else 1, "10:30 = " + Round(RTH4HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH4Hr == 0 and RTH4Hr[1] == 1 then yes else no, "10:30", color = Color.WHITE);
def RTH5Hr = SecondsFromTime(RTH5HrstartTime) >= 0 and SecondsTillTime(RTH5HrendTime) > 0;
def RTH5HrVol = if RTH5Hr and !RTH5Hr[1] then volume else if RTH5Hr then RTH5HrVol[1] + volume else RTH5HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH5HrVol then 0 else 1, "11:30 = " + Round(RTH5HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH5Hr == 0 and RTH5Hr[1] == 1 then yes else no, "11:30", color = Color.WHITE);
def RTH6Hr = SecondsFromTime(RTH6HrstartTime) >= 0 and SecondsTillTime(RTH6HrendTime) > 0;
def RTH6HrVol = if RTH6Hr and !RTH6Hr[1] then volume else if RTH6Hr then RTH6HrVol[1] + volume else RTH6HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH6HrVol then 0 else 1, "13:00 = " + Round(RTH6HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH6Hr == 0 and RTH6Hr[1] == 1 then yes else no, "13:00", color = Color.WHITE);
def RTH8Hr = SecondsFromTime(RTH8HrstartTime) >= 0 and SecondsTillTime(RTH8HrendTime) > 0;
def RTH8HrVol = if RTH8Hr and !RTH8Hr[1] then volume else if RTH8Hr then RTH8HrVol[1] + volume else RTH8HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH8HrVol then 0 else 1, "POST= " + Round(RTH8HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH8Hr == 0 and RTH8Hr[1] == 1 then yes else no, "POST- MARKET", color = Color.WHITE);
#End Volume
Here is script https://tos.mx/NJ1JF4N
Hello, I have created hourly volume study label (Please see below). I would like to add 30 days average volume with same label. Can you please help me?
#HOURLY VOLUME STUDY#
input ShowRTH1HrVol = yes;
input ShowRTH2HrVol = yes;
input ShowRTH3HrVol = yes;
input showRTH4HrVol = yes;
input showRTH5HrVol = yes;
input showRTH6HrVol = yes;
input showRTH7HrVol = yes;
input showRTH8HrVol = yes;
def RTH1HrstartTime = 0930;
input RTH1HrendTime = 1029;
def RTH2HrstartTime = 1030;
input RTH2HrendTime = 1129;
def RTH3HrstartTime = 1130;
input RTH3HrendTime = 1229;
def RTH4HrstartTime = 1230;
input RTH4HrendTime = 1329;
def RTH5HrstartTime = 1330;
input RTH5HrendTime = 1429;
def RTH6HrstartTime = 1430;
input RTH6HrendTime = 1600;
def RTH7HrstartTime = 0400;
input RTH7HrendTime = 0929;
def RTH8HrstartTime = 1601;
input RTH8HrendTime = 2000;
def RTH7Hr = SecondsFromTime(RTH7HrstartTime) >= 0 and SecondsTillTime(RTH7HrendTime) > 0;
def RTH7HrVol = if RTH7Hr and !RTH7Hr[1] then volume else if RTH7Hr then RTH7HrVol[1] + volume else RTH7HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH7HrVol then 0 else 1, "PRE = " + Round(RTH7HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH7Hr == 0 and RTH7Hr[1] == 1 then yes else no, "PRE-MARKET", color = Color.WHITE);
def RTH1Hr = SecondsFromTime(RTH1HrstartTime) >= 0 and SecondsTillTime(RTH1HrendTime) > 0;
def RTH1HrVol = if RTH1Hr and !RTH1Hr[1] then volume else if RTH1Hr then RTH1HrVol[1] + volume else RTH1HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH1HrVol then 0 else 1, "7:30 = " + Round(RTH1HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH1Hr == 0 and RTH1Hr[1] == 1 then yes else no, "07:30", color = Color.WHITE);
def RTH2Hr = SecondsFromTime(RTH2HrstartTime) >= 0 and SecondsTillTime(RTH2HrendTime) > 0;
def RTH2HrVol = if RTH2Hr and !RTH2Hr[1] then volume else if RTH2Hr then RTH2HrVol[1] + volume else RTH2HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH2HrVol then 0 else 1, "8:30 = " + Round(RTH2HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH2Hr == 0 and RTH2Hr[1] == 1 then yes else no, "08:30", color = Color.WHITE);
def RTH3Hr = SecondsFromTime(RTH3HrstartTime) >= 0 and SecondsTillTime(RTH3HrendTime) > 0;
def RTH3HrVol = if RTH3Hr and !RTH3Hr[1] then volume else if RTH3Hr then RTH3HrVol[1] + volume else RTH3HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH3HrVol then 0 else 1, "9:30 = " + Round(RTH3HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH3Hr == 0 and RTH3Hr[1] == 1 then yes else no, "09:30", color = Color.WHITE);
def RTH4Hr = SecondsFromTime(RTH4HrstartTime) >= 0 and SecondsTillTime(RTH4HrendTime) > 0;
def RTH4HrVol = if RTH4Hr and !RTH4Hr[1] then volume else if RTH4Hr then RTH4HrVol[1] + volume else RTH4HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH4HrVol then 0 else 1, "10:30 = " + Round(RTH4HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH4Hr == 0 and RTH4Hr[1] == 1 then yes else no, "10:30", color = Color.WHITE);
def RTH5Hr = SecondsFromTime(RTH5HrstartTime) >= 0 and SecondsTillTime(RTH5HrendTime) > 0;
def RTH5HrVol = if RTH5Hr and !RTH5Hr[1] then volume else if RTH5Hr then RTH5HrVol[1] + volume else RTH5HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH5HrVol then 0 else 1, "11:30 = " + Round(RTH5HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH5Hr == 0 and RTH5Hr[1] == 1 then yes else no, "11:30", color = Color.WHITE);
def RTH6Hr = SecondsFromTime(RTH6HrstartTime) >= 0 and SecondsTillTime(RTH6HrendTime) > 0;
def RTH6HrVol = if RTH6Hr and !RTH6Hr[1] then volume else if RTH6Hr then RTH6HrVol[1] + volume else RTH6HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH6HrVol then 0 else 1, "13:00 = " + Round(RTH6HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH6Hr == 0 and RTH6Hr[1] == 1 then yes else no, "13:00", color = Color.WHITE);
def RTH8Hr = SecondsFromTime(RTH8HrstartTime) >= 0 and SecondsTillTime(RTH8HrendTime) > 0;
def RTH8HrVol = if RTH8Hr and !RTH8Hr[1] then volume else if RTH8Hr then RTH8HrVol[1] + volume else RTH8HrVol[1];
AddLabel(if GetAggregationPeriod() > AggregationPeriod.THIRTY_MIN or !ShowRTH8HrVol then 0 else 1, "POST= " + Round(RTH8HrVol, 2), Color.YELLOW);
AddVerticalLine(if GetDay() == GetLastDay() and RTH8Hr == 0 and RTH8Hr[1] == 1 then yes else no, "POST- MARKET", color = Color.WHITE);
#End Volume
Here is script https://tos.mx/NJ1JF4N