The simple way to buy/sell at the beginning/end of a trading week is to use "Date is a day of week", but how does one account for trading holidays that are frequently on Friday's or Monday's? Is there a condition that equates to the first/last trading day of the week instead of a named day?
Size:
Color:
Sure it's possible to do using WealthScript code with a little help of Community Components:
CODE:
Please log in to see this code.
As you understand it's not readily available for Rule-based strategies. Like I showed you in a
different topic, for "Monday" (first trading day of week) or "Friday" (last trading day of week) you can accomplish this automatically by switching to Weekly bars.
Conditions which account for holidays is something to consider. We could think about adding them to Community.Rules if there are community-requested candidates
and it's feasible. Apparently it wasn't requested before.
Size:
Color:
Size:
Color:
FirstTradingDateOfTheWeek seems to know when there is a holiday. I tried 1/24/2020 and it knows 1st trading day of the week is 1/21/2020.. safe to use it or my test case is not valid
Size:
Color:
All the"TradingDate" functions check for weekends and U.S. holidays.
Size:
Color:
yeah works perfectly, thx
Size:
Color: