# 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);
#