Hi Ted -- Yes, you can design a trading system in AmiBroker that recognizes what type of a market it seems to be in, then issue trading signals based on the market type and the system specific to it.
Keep in mind the "curse of dimensionality" that will show up when you try to put everything into a single afl. If you have two systems, each with four optimizable parameter values, and a ninth parameter to decide which set of four to use, you will be optimizing and walking forward all nine, even though only five will be in use at any given time. If each parameter has "only" 10 possible values, the 9 parameter runs will evaluate 9^10 alternatives (using exhaustive searching), while the 5 parameter runs will evaluate 5^10. Since there is no overlap between the two market types, there are a lot of evaluations that will make no difference. That is, the value of the objective function will be computed for each, but will be the same for many. You might be better off writing two separate programs. One afl program recognizes Market Type A, and selects the best logic and parameters for that type; the other recognizes Market Type B, and selects the best logic and parameters for that type. In terms of optimization runs, doing everything at once costs 9^10 runs, while doing the two separately costs 2*5^10 -- a factor of 5000. If doing the development for one of the four-plus-one parameter systems takes one hour of computer time, doing the two separately takes two hours, and doing both in a single nine parameter afl takes 10000 hours -- over a year. Non-exhaustive optimization will help a lot, but not completely remove the curse. (I know -- times are not strictly proportional.) Thanks, Howard
