calculate 3rd wednesday of the month

randomx

New member
does anybody know of a function or script where it would show me the 3rd wednesday of the month?
 
Last edited:
Solution
does anybody know of a function or script where it would show me the 3rd wednesday of the month?

I looked up a couple of functions and combined their examples.
the variable, third_wed , will be true during the 3rd wed of the month.
a yellow bubble appears on the 1st bar, of the desired day.
white wedges appear under the desired day.

Ruby:
# check for 2 conditions,
#   is it a wed?
#   if the day in the 3rd week?
# combine them

# ------------------------------------
# check if it is a wednesday
# i copied the example and moved the word  default to be in front of wednesday.
input day_of_week = {Monday, Tuesday, default Wednesday, Thursday, Friday, Saturday, Sunday};
def day1 = if  (GetDayofWeek( GetYYYYMMDD() ) == day_of_week +...
does anybody know of a function or script where it would show me the 3rd wednesday of the month?

I looked up a couple of functions and combined their examples.
the variable, third_wed , will be true during the 3rd wed of the month.
a yellow bubble appears on the 1st bar, of the desired day.
white wedges appear under the desired day.

Ruby:
# check for 2 conditions,
#   is it a wed?
#   if the day in the 3rd week?
# combine them

# ------------------------------------
# check if it is a wednesday
# i copied the example and moved the word  default to be in front of wednesday.
input day_of_week = {Monday, Tuesday, default Wednesday, Thursday, Friday, Saturday, Sunday};
def day1 = if  (GetDayofWeek( GetYYYYMMDD() ) == day_of_week + 1) then 1 else 0;

# ------------------------------------
# check if the date is in the 3rd week of the month.

# days of month
# 1-7  1st week
# 8-14  2nd
# 15-21  3rd
# 22-28  4th
input first_day = 15;
input last_day = 21;
def daymo = if ( GetDayofMonth( GetYyyyMmDd() ) between first_day and last_day) then 1 else 0;

# ------------------------------------

# true when the 3rd wed of the month.
def third_wed = (day1 and daymo);

# ------------------------------------

# draw a shape, on the bars of the 3rd wed
input show_shapes_third_wed = yes;
plot z = if show_shapes_third_wed then third_wed else 0;
z.SetPaintingStrategy(PaintingStrategy.BOOLEAN_WEDGE_down);
z.setdefaultcolor(color.white);
z.setlineweight(4);

# find the first bar of wed (intraday chart)
# this is true on the first bar, of the 3rd wed.
input show_bubble_on_wed = yes;
def firstbarofwed = if (show_bubble_on_wed and !third_wed[1] and third_wed ) then 1 else 0;
addchartbubble( firstbarofwed, high * 1.001, "3rd wed", color.yellow, yes);
#


QgSqXuw.jpg



https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Date---Time/GetDayOfWeek
Returns the day of week based on the given YYYYMMDD parameter. The return value ranges from from 1 (Monday) to 7 (Sunday).

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Date---Time/GetDayOfMonth

https://tlc.thinkorswim.com/center/...ingStrategy/PaintingStrategy-BOOLEAN-WEDGE-UP

https://tlc.thinkorswim.com/center/reference/thinkScript/Functions/Look---Feel/SetPaintingStrategy
 
Solution

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
217 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