Next trading day

Viewing 2 posts - 1 through 2 (of 2 total)
  • #35696

    How do i manage the following problem:

     

    Say i have a daily strategy and want to buy every month on the 10th or the next trading day in case the 10th is a holiday/weekend.  In the datafeed of the security the non-tradingday simply do not exist. So if the 10th is for example a sunday the datafeed jumps from friday 8th directly to monday 11th.

    Any ideas how i can accomblish this conveniently?

    #35703

    I coded something similar recently for Doctrading, about finding the last day of month: https://www.prorealcode.com/topic/astuce-dernier-jour-du-mois/page/2/

    At the beginning of the thread, you can find this code snippet that will give you the day of the week number by looking with its date:

    It’s the Keith algorithm. So if the D value is a Sunday for the 10th day of the month you look at, then you know you have to adapt the strategy to trade the next day.. Hope I’m clear 🙂

     

    1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login