The system rotation function allows you to rotate systems based on which one back-tests the most profitably on the current stock for the fixed number of periods you specify. There are 6 provided system rotation functions to rotate between 2 - 7 different systems. The functions are defined as follows:
SystemRotate2(Buy1, Sell1, Buy1, Sell1, LookBack);
SystemRotate3(Buy1, Sell1, Buy2, Sell2, Buy3, Sell3, LookBack);
SystemRotate4(Buy1, Sell1, Buy2, Sell2, Buy3, Sell3, Buy4, Sell4, LookBack);
If you need to rotate between more systems, simply increment the number in the function name. To use the functions simply supply the buy and sell signals of your different systems and the function will automatically set the Buy and Sell variables to the new combined signals. The following is an illustration of how to rotate between two systems.
BuyMA = Cross(C, EMA(C, 30));
SellMa = Cross(EMA(C, 30), C);
BuyMACD = Cross(MACD(), Signal());
SellMACD = Cross(Signal(), MACD());
RotateSignals2(BuyMA, SellMA, BuyMACD, SellMACD, 250);
The above formula can be backtested because RotateSignals2 will automatically set the Buy and Sell variables to the new combined system.