Daylight savings code

Forums ProRealTime English forum ProOrder support Daylight savings code

Viewing 15 posts - 1 through 15 (of 15 total)
  • #163953

    As from monday we’ve got 2 weeks when the American and European daylight savings are out of synch, and I’d like to have a piece of code to allow for the hour difference in opening time.

    I’m sure the following is wrong, but you get the general idea.  I find the documentation very unclear about how to specify dates.

     

    3 users thanked author for this post.
    #163954

    You need to remove ONCE from line 1, because it must be evaluated everyday, not just the first time in autotrading.

     

    2 users thanked author for this post.
    #163955

    Thanks Roberto, I wasn’t so completely wrong then!

    But I just remembered there’s another week in November that needs correcting. UK DLS ends 31 Oct and the American on Nov 7, so can I use:

     

    #164006

    I refined and expanded the code to cover the period 2010 to 2024 and it seems to work in terms of altering the opening times of trades during those weeks – this is for an algo that only operates in the DOW’s first hour so for me the change is crucial.

    But unfortunately it also seems to alter the results for trades taken outside of those periods. If you look at the attached image, you can see that the dates, times, and number of bars is identical, but the profit is completely different. The figures on the right are adjusted for American Daylight Savings (although those dates fall outside of the adjusted period), the figures on the left have no adjustment at all.

    ???

    1 user thanked author for this post.
    #164008

    Never mind, I found the problem – nothing to do with that code, which seems ok. 😁

    #191609

    I found the problem

    Hi, curious has anyone found a solution to change the trade-times for daylight savings without having to individually put in each years daylight savings dates as above?

    Ive tried the suggestions here: https://www.prorealcode.com/topic/programmed-daylight-savings-time-change-code-block/

    but they didn’t work, was still opening times during daylight savings the same as out.

    #191625

    there’s a strong chance the Americans will do away with the clock change altogether so it might not be a problem.

    https://www.reuters.com/world/us/us-senate-approves-bill-that-would-make-daylight-savings-time-permanent-2023-2022-03-15/

    #191644

    there’s a strong chance the Americans will do away with the clock change altogether so it might not be a problem.

    Maybe the problem persists even more;
    Right now there’s a chance that all fall together (in spring as well as in autumn). When this goes through then there’s definitely a change twice a year.

    🙂

    #191663

    sh*t, you’re right of course … hadn’t thought that through.

    #191665

    If only PRT could come up with a solution that “communicates” over these issues. They are of vast importance (says me, says you) but at least for backtesting they can’t be solved really. Yeah, with code like you proposed. But now integrate with the Aussies (like I tried with Kev Monaghan the past days – just not doable).

    The time constraints are a sheer pain throughout. Maybe I understand Futures by now. Just maybe. But only the $ (financial) assets. … unsolvable ?

    #191667

    integrate with the Aussies

    so it might not be a problem.

    Definitely a problem remains for us Aussies. Sydney changed a +2 hours compared to London time last month. As our DLS finished (- 1 hour) and your BST started (+1hr), which has really messed around all my strategies performances, my strategies placing orders 2 hours outside of the actual London trade times for example.

    I’m also not sure if you change your platforms time to the instruments “local time” and then launch the strategy if that would mean that adjusts automatically to local time (eg. +/- 1hr related to BST), or not, cant find anything in the PRT manuals on this?

    I tried to work out it out: https://www.prorealcode.com/topic/prt-strategy-adjust-local-tradetime-when-daylight-savings-time-changes-1hr/ – no answer on that topic yet.

    But as you can see on that topic  the performance even with the code seems worse, which means i must still not have it sorted or my logic is all wrong.

     

    #191772

    It’s an extra burden for Aussie traders because of the UK + US + AU time changes.

    I can solve it but how many traders here really need this solved?

    #198455

    I do, or any other Aussies, which i assume is a lot considering IG is our biggest broker in Australia (well so they claim).

    #201463

    Hi guys, I’m a bit late to this but I *think* you’re all overthinking this.. I used to have the exact same issues.. to fix it I went to – Platform Settings >> Time Zones and Trading Hours. Then click ‘Use different time zones for different markets as specified below:’.. then you find the relevant market (I tend to test on the Dow, so; Indices – US) then you click both ‘Use the local market time zone’ and ‘Use trading hours of this market’.

    Once that’s done you just code in local times, so if you’re trading the US open use 093000.. no need to adjust for any DSL or differences in time zones whatsoever! Hope that helps!

    #201541

    Eh, wow ?

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

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