Is it possible to add code to make my algo sell all the current positions and move everything to cash based on the p/e ratio of a specific stock or ETF?
For example, if the p/e ratio of Microsoft (MSFT) rises above 25, the algo below would sell all positions at the next rebalance date and remain in cash until the p/e falls below 20, at which point the buying would resume.
Any help or suggestions would be appreciated.
Thanks,
Troy