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

MACD periods, QP scans



PureBytes Links

Trading Reference Links

Ed: Try this formula for MACD, so you can use periods other than the 12, 26
and 9 in Metastock's canned formula: 

period1:=13;
period2:=34;
period3:=89;
Mov(C,period1,E) - Mov(C,period2,E);
Mov((Mov(C,period1,E) - Mov(C,period2,E)),period3,E)

The first one is the MACD: 

Mov(C,period1,E) - Mov(C,period2,E);

The second one is the signal line:

Mov((Mov(C,period1,E) - Mov(C,period2,E)),period3,E)

You can get the values for QP's MACD histogram in this Metastock formula:

period1:=13;
period2:=34;
period3:=89;
(Mov(C,period1,E) - Mov(C,period2,E))-(Mov((Mov(C,period1,E) -
Mov(C,period2,E)),period3,E))

The MACD histogram is just MACD minus the signal line. It's an oscillator that
shows when MACD crosses the signal line. The crossing point is zero.  

Try these periods for MACD: 

13, 34, 89

5,35,4

8, 17,9 

The first one (13,34,89) is a good longer-term MACD. The second (5,35,4) is a
good shorter-term one. 

Here's a QP scan that gives MACD values (for variable periods). Put in the
periods you want:

a:=8;
b:=17;
c:=9;

Here's the scan:

//MACD (Variable): Get values for MACD(0); 
//MACDSignal(0); Histogram; and Histogram Percent +/-
//by Brooke 

output="macd.lst";
//input="portfoli.lst";
issuetype=common;
exchange nyse,nasdaq,amex;
DaysToLoad=500;

integer a, b, c;
float histogram, histogramprev, percentchange;

a:=8;
b:=17;
c:=9;

Set MACD = a,b,c;

histogram:=MACD(0)-MACDSignal(0);  //this creates oscillator to look
//for macd crossing its signal line; 0 represents crossing point
histogramprev:=MACD(-1)-MACDSignal(-1);  //yesterday's value

percentchange:=((histogram-histogramprev)/abs(histogramprev+.0000001))*100;


println Symbol:-3, ",", "Close: ":-3,Close(0):7:3,"," ,
 " MACD ", ",", MACD(0):7:4,"," , " MACDSignal ", ",",
 MACDSignal(0):7:4,"," , " Histogram ", ",", histogram:7:4, 
" Histogramprev ", ",", histogramprev:7:4, 
" Histogram percent +/- ", ",", percentchange:7:4; 

***********************

Here's a scan that looks for MACD crossing the signal line:

//MACD Crossing Signal Line (variable) 
//crossing signal line (variable), by Brooke 

output="macdcross.lst";
//input="portfoli.lst";
issuetype=common;
exchange nyse,nasdaq,amex;
DaysToLoad=500;

integer a, b, c;
float histogram, histogramprev, percentchange;

a:=5;
b:=35;
c:=4;

Set MACD = a,b,c;

histogram:=MACD(0)-MACDSignal(0);  //this creates oscillator to look
//for macd crossing its signal line; 0 represents crossing point
histogramprev:=MACD(-1)-MACDSignal(-1);  //yesterday's value

percentchange:=((histogram-histogramprev)/abs(histogramprev+.0000001))*100;

if histogram > 0 and
histogramprev < 0 then 
println Symbol:-3, ",", "BUY , Close: ":-3,Close(0):7:3,"," ,
 " MACD ", ",", MACD(0):7:4,"," , " MACDSignal ", ",",
 MACDSignal(0):7:4,"," , " Histogram ", ",", histogram:7:4,
 " Histogram percent +/- ", ",", percentchange:7:4; 
endif;