So, quick question in case this is already implemented in Return.portfolio, but this is something that's been bugging me for a while now.
Say you're backtesting a momentum strategy, with your rebalance dates being monthly endpoints. While in a perfect world, you'd get your closing data at the close and have time to rebalance the strategy right then and there, in the real world, you might not have closing data until the next morning--or you're a large fund that takes a day to move capital into position, or whatever other real-world constraint.
For instance, here's an obligatory minimum reproducible example:
out <- Return.portfolio(R = posRets, weights = wts)
Now, given that the weights are allocated at the end of every month, if we have a 1-day lag to account for execution, I'd expect the first day of each new month to be identical to the day before it. That is, if the previous month had a zero return because it was invested in the second asset, then the first day of the new month should also have a zero return, and vice versa.
This is not the case.
Is there a lag setting in Return.portfolio to account for this, or should I write the function myself?