Q re: tdm() and tom()

Posted By: Mook_Yon

Q re: tdm() and tom() - 11/05/17 14:39

Hi,

Could anybody help on this little thing?
I expected that a [Test] with D1 data and BarPeriod = 1440a statement like this:
Quote:
if(tdm(0)==tom(0)) {code()}

would invoke code() every end of month. However, some months are skipped (e.g., in 2017, code() was NOT invoked on JAN, FEB, APR, and MAY... in earlier years, different months skipped).

Is there any explanation for that behavior?

BTW, data checked for Gaps.

THX!
Posted By: jcl

Re: Q re: tdm() and tom() - 11/06/17 08:44

This happens due to gaps are in the data. When you check for gaps, you'll see that D1 data has usually many missing days due to holidays.

Holidays are not accounted for in tdm() and tom(), so the comparison tdm(0)==tom(0) will only work when no full days are missing, such as with M1 data of 24 hours traded assets. Otherwise you need to check the day of week for determining if you're at the end of the month.
© 2024 lite-C Forums