dayShift backwards and forwards

Forums ProRealTime English forum ProOrder support dayShift backwards and forwards

Viewing 7 posts - 1 through 7 (of 7 total)
  • #203417

    Hello!

    Is there a way to implement the equivalent of the CalcDate function from EasyLanguage in ProRealCode?

    I want to be able to test an entry condition based on a fixed date +/- “daysShift” days.

    E.g. let’s say
    event = 20221031 // 31st Oct 2022
    I need a way to enter the market “daysShift” days before the event.

    After the event, I can use the lookback, i.e. (date = event)[1]… and I want something for lookforward.
    Any ideas?

    Thanks!

    #203421
    JS

    Hi @dimi-tree

    What you can try is:

    If Date = 20221031 then
    Here your conditions…
    EndIf

    #203422
    JS

    Hi @dimi-tree

    If you stay in the same month, you can also move the days forwards or backwards…

    If Date = 20221015 + 15 then (equals 20221030)
    If Date = 20221015 – 13 then (equals 20221002)

    #203467

    If you stay in the same month,

    Hi @JS,

    Why this “condition” ?
    20221015 + 40 does not work ?

    #203488
    JS

    Don’t know what’s going on but the whole “Date” thing doesn’t work right at all anymore…

    1 user thanked author for this post.
    #203494

    20221015 + 40 equals 20221055. There’s no day 55!

    Maths on dates & times is a bit difficult to do, as you first have to compare if the sum exceeds the last day of the month, if yes, then compute the remaining days, increase the month (two middle digits) checking that it doesn’t exceed 12 (otherwise you also need to increase the year, the leftmost 4 digits), then add the remaining days to the new date and so on… until the remaining days total 0.

     

     

    1 user thanked author for this post.
    #203518

    Maths on dates & times is a bit difficult to do

    Sadly I am more than aware of this throughout my “life”. But easy to do once you are used to it.

     

    Don’t know what’s going on but the whole “Date” thing doesn’t work right at all anymore…

    I seriously thought this worked nicely in PRT, but maybe I dreamed it !?

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

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