"Date is a day of week" and trade holidays
Author: lanatmwan
Creation Date: 5/27/2020 3:25 AM
profile picture


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?
profile picture


Sure it's possible to do using WealthScript code with a little help of Community Components:

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.
profile picture


Re: Holidays:
DateOfNextTradingDay considers holidays.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).