How to overcome this issue (weeks contains holidays )

huab

New member
I wanted to make a study that divides last week volume to the week before.. (timeaggreg: week), the problem is that there are 9-10 weeks during the year with 4 trading days, so the comparision will not be logical..
Can I use calculations from getweek(), getdayofweek() -and any other data- functions, or there are an easier/straightforwad ways?
 
Solution
I think, the most straight forward approach would be to compare the sum of the preceding 5 days to the sum of the 5 days before those:
sum(volume(aggregation daily), 5) / sum(volume(aggregation daily)[6], 5)
or something like that.

it's a trade off (no puns intended) that will give you a rolling week rather than a static Monday to Friday week, but it may prove useful.

The most important questions, and the one that @Joshua tried to get at is what will you do with your statistics when you find a four-day week. That is a question whose answer will determine the approach you take in mitigating the bad data that a 4 day week presents in analysis.

If you could determine the four day weeks, would you simply multiply the volume...

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

I think, the most straight forward approach would be to compare the sum of the preceding 5 days to the sum of the 5 days before those:
sum(volume(aggregation daily), 5) / sum(volume(aggregation daily)[6], 5)
or something like that.

it's a trade off (no puns intended) that will give you a rolling week rather than a static Monday to Friday week, but it may prove useful.

The most important questions, and the one that @Joshua tried to get at is what will you do with your statistics when you find a four-day week. That is a question whose answer will determine the approach you take in mitigating the bad data that a 4 day week presents in analysis.

If you could determine the four day weeks, would you simply multiply the volume for the week by 1.25?

Another random thought is this:
https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Date---Time/CountTradingDays
You might be able to use some magic to determine if a given number of days in the past is the same number of trading days in the past. Just a thought.

Perhaps it's helpful, perhaps not so much so
-mashume
 
Solution
Can you use them... to do what? What is your plan on how to handle the four day weeks?
I imagined if i used getyear(), then we know from the calendar holidays fall in which weeks, getweek() returns the week number from 1 to 53, then make a condition if getweek equal 3, for example, and that was 4 trading days, then multiply the volume by 1.25 ..
I mistakenly typed getdayofweek() as I was thinking of other way but it required multi aggregation times (then, for example if the volume of the symbol in day 4 of the week is nan then multiple the previous one by 1.25 ..
(I'm still a beginner)
 
Yes, if you actually wanted to check the calendar and do it manually like that, it could work. A better question might be, what type of chart are you planning to use this indicator on, and-or how do you intend on displaying the data? The most effective method I could think of would require the script to be used on a daily chart, which would reconstruct the weeks from that perspective, and automatically detect the four day weeks.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
443 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