Hi All, I have written a simple program. When MACD and Signal cross over, while MA20 and MA50 cross over, and their directions are the same, the system gives the signal for buying or selling. Showed as following:
Cond = Cross( MA(Close, 20), MA(Close, 50) ); Cond1 = Cross( MA(Close, 50), MA(Close, 20) ); Cond2 = Cross(MACD(12, 26), Signal(12, 26, 9)); Cond3 = Cross(Signal(12, 26, 9), MACD(12, 26)); Buy = Cond AND Cond2; Sell = Cond1 AND Cond3; For example: on the 1st day MA20 and MA50 cross over, on the 2nd day MACD and Signal cross over, and their directions are the same, at this point the system gives the signal for buying or selling. For another example: on the 1st day MACD and Signal cross over, on the 2nd day MA20 and MA50 cross over, and their directions are the same, at this point the system gives the signal for buying or selling. How to revise the above program in order to satisfy the conditions? Any help would be appreciated! Thanks, Robert
