Rebalance first trading day of the month (not every 4 weeks)

I know there is no monthly rebalancing, but I need to find a solution because my portfolio rebalances on weird days like May 12 or June 7 etc.

I was wondering, using buy/sell rules cold it be possible to test the date or day of the month like if the date is 1,2,3,4,5,6,7 (of the month) buy on the first “open” day or trading day or something? And the reverse, sell on 28,29,30 if they day is trading…

Thanks guys.

This is the way I do it. Since “MonthDay” is just a day and not a trade day I add extra days to ensure a trade day is hit. For example if the 1st is a Saturday and Monday a holiday the first possible trade day would be the 4th. Also trade frequency needs to be daily. Same concept for end of month.

Buy Rules since all statements are “and” only need somthing like
(MonthDay=1 or MonthDay=2 or MonthDay=3 or MonthDay=4)

Sell Rules since all statements are “or” need to combine the above with all statements.
like Rank < 92 and (MonthDay=1 or MonthDay=2 or MonthDay=3 or MonthDay=4)

For a portfolio you can switch it to manual and have it rebalance any time you want. Dadoz has a good way to backtest this.

I have implemented this with the following formula:

(MonthDay>=1) AND (MonthDay<=7)

If you set to weekly rebalancing, the port or simulation should theoretically rebalance on the first trading day of the month.

OK got it. The solution is a mix of all these:

Set frequency rebalance to daily (otherwise bunch of days are missed when running rules)

Then set buy rule to: (MonthDay>=1) AND (MonthDay<=7)

Set Sell Rule to (on one line!): (MonthDay>=28) AND (MonthDay<=31) AND (Rank < 90)

Unfortunately its NOT perfect but the sell rule needs to run like that because of february.

Tested and looked at trades and the results are VERY close to buy on first day of month and sell on last day of month.

Why is it important to sell on the last day, and buy on the first day? Wouldn’t that lead to being out of the market for one day each month?

For monthly strategies, I just set to weekly rebalance and the sell rule:

(Rank < XX) AND (MonthDay>=1) AND (MonthDay<=7)

This will lead to buying and selling (i.e., rebalancing) on the first trading day each month.

I didn’t think about that! You’re saying that bu just setting a buy rule it will “overwrite” the current position automatically. Does it show I’m a p123 newbie!

I’m saying that the rebalancing process is driven by the sell rules. When positions are sold on a rebalance date, they are replaced by buying the top-ranked securities in your model. Your buy / sell rules above will lead to selling on one day, and holding cash until securities are purchased on another day. Try using the sell rule that I suggested, and I think it will lead to what you are looking for, which is monthly rebalancing.

J - to get exactly what you want, try using this as the sole sell rule:

MonthDay<FHist(“MonthDay”,1)&NoDays>20

See the application of the rule in the following example: https://www.portfolio123.com/port_summary.jsp?portid=1194976

Steve