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!
JSParticipant
Senior
Hi @dimi-tree
What you can try is:
If Date = 20221031 then
Here your conditions…
EndIf
JSParticipant
Senior
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)
If you stay in the same month,
Hi @JS,
Why this “condition” ?
20221015 + 40 does not work ?
JSParticipant
Senior
Don’t know what’s going on but the whole “Date” thing doesn’t work right at all anymore…
20221015 + 40 equals 202210
55. 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.
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 !?