I am really new to portfolio123 and I am struggling to figure out how to implement 2 different market filters.
The first is to take the 8-12 month SMAs of the benchmark and for each one that the close price is below reduce the allocation by 10%. So if the price was below all moving averages the portfolio would be 50% cash but if only 3 were triggered it would be 30% cash.
The second is to take the percentile rank of the index 21 day Vol (ATR) over the last 3 years and if the current month is above the 90th percentile then go to 50% cash
I'm not sure the first can be done with our current setup.
For the second, create an Aggregate Series that divides the current month's ATR by the 3-year ATR. The signal in the simulation hedge would then call up the series and go to 50% cash if the result is greater than 0.9.
For the first, define a formula that counts the SMAs: (Price < SMA(..., 0, #Bench)) + ... + (Price < SMA(..., 0, #Bench))
Then you can have PosCnt <= N * (1 - 0.1 * $formula) in a buy rule and PosCnt > N * (1 - 0.1 * $formula) in a sell rule, replacing N with the ideal number of positions of the portfolio.
Note that since it's being implemented using buy/sell rules, it will only be enforced upon rebalance.
thank you for the help. Does this solution reduce the number of positions held or does it reduce the allocation and increase the cash while still holding N positions?
It reduces the number of positions held which translates to increasing cash. For the Static Weight sizing method, it works as is. For the Dynamic Weight sizing method, the Max Constraint setting would need to be set to around (100/N)% to limit the allocation when fewer than the ideal number of positions are held.
would this formula in size not work if accompanied by similar sell rules to trigger a rebalance? I am trying to go to up to 50% cash when general market is below smas