[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] RE: MACD and Signal Crossover



PureBytes Links

Trading Reference Links

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


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.2/613 - Release Date: 1/1/2007 2:50 PM