Need help to add 30 days average hourly volume label

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
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
532 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top