I'm trying to code a function that calculates monthly dates from a certain date or vice versa.
I will use the function for setting dates for rotational trading backtests, e.g., rotating every 13 month from January 25, 1980, etc. It must follow a normal financial market convention : - if the next rotation date is a holiday, the rotation date would be the first following day that is a business day. -if the rotation date is a month end, the rotation date is determined on an end-end basis, i.e., 18-month rotation from February 28, 2007 would rotate on October 31, 2008, not October 28, 2008, etc. Somehow I'm getting lots of floating point irregularities such as yyy * 100 + mm != yyymm during the process and almost gave up. Does anyone already have the function ?
