Auto selecting last trading day of the month

Forums ProRealTime English forum ProBuilder support Auto selecting last trading day of the month

  • This topic has 4 replies, 2 voices, and was last updated 2 years ago by avatarsmp.
Viewing 5 posts - 1 through 5 (of 5 total)
  • #180439
    smp

    Hi guys,

    I have completed a strategy trading on the last trading day of each month but the code seems a little “clunky”, does anyone know how I can improve the code I have written to always trade on the last trading day of the month?

    Area of the code to improve:

    =========================

     

     

    #180443

    This is a code snippet that calculates the last trading day of the month https://www.prorealcode.com/topic/codes-for-not-opening-trades-at-month-end/#post-175920

     

    1 user thanked author for this post.
    avatar smp
    #180445
    smp

    Thank you, my save hard coding each day every month.  I Will still have to ensure the holidays and time differences plus daylight saving hours are put in every as PRC has no way to determine this!  Or has it?

    #180456

    As to DST  you have to account for it according to the instrument or asset traded, as there’s no way to automatically detect it.

    As to holidays, well… you can’t start any trade as the market is closed. The only issue is when you want to close open positions BEFORE the holiday, in which case you will have to read a news calendar every year (they are usually available prior to December 31st) and set them manually in your code each year.

     

    1 user thanked author for this post.
    avatar smp
    #180470
    smp

    Thank you for your time.  I have manually incorporated holidays now.

Viewing 5 posts - 1 through 5 (of 5 total)

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