Well, I wish you had V2, because you'd love the MACD scan, which tells when the histogram crosses 0 and when the trend (up or down) began. Here's what the output looks like (this data isn't up to date, by the way, and the MACD variables are 13, 14 and 89):
ALDNF , Sell: 14.750, - Cross ,15 days ago, - Trend ,4 days ago AMAT , Buy : 36.000, + Cross ,17 days ago, + Trend ,18 days ago
When the crossover is today, Buy and Sell are marked with an asterisk. Trend indicates how many days the histogram has been up or down.
MACD is variable in the scan (you can specify values for the EMA's and histogram).
What values for MACD do you prefer? For longer-term signals, I use 13, 34, 89, on the advice of Richard Estes. For the short term, I use 5, 35, 4, which Bill Sandusky uses in his system, BNS.
The scan started out pretty complicated, but it was Bill's idea to focus on two things: crossings and trend.
The scan is for QP2, but here it is:
//MACD histogram crossing up and down through 0, by Brooke Elise Nagler //With +/- crossings and trends based on system by Bill Sandusky
output="macdtrend.lst";
issuetype=common; exchange nyse,nasdaq,amex; DaysToLoad=500;
integer a, b, c, i, j, l, m, n, daysback; float histogram, histogramprev, alert1, alert, alert2, alert3;
a:=13; //EMA b:=34; //EMA c:=89; //Signal line
daysback:=35; //Number of days to look back for 0 crossings
Set MACD = a,b,c;
histogram:=MACD(0)-MACDSignal(0); histogramprev:=MACD(-1)-MACDSignal(-1);
// alert1 looks for when MACD histogram crossed up through 0 alert1:=0; for j = -daysback to 0 step 1 do if (MACD(j)-MACDSignal(j))>0 and (MACD(j-1)-MACDSignal(j-1))<0 then alert1:=-j; endif;
next j;
//alert looks for how many days histogram has moved up //by counting back to down day alert:=0; for i = -20 to 0 step 1 do if (MACD(i)-MACDSignal(i))< (MACD(i-1)-MACDSignal(i-1))then alert:=-i; endif;
next i;
// alert2 looks for when MACD histogram crossed down through 0 alert2:=0; for m = -daysback to 0 step 1 do if (MACD(m)-MACDSignal(m))<0 and (MACD(m-1)-MACDSignal(m-1))>0 then alert2:=-m; endif;
next m;
//alert3 looks for how many days histogram has moved down //by counting back to up day alert3:=0; for n = -20 to 0 step 1 do if (MACD(n)-MACDSignal(n))> (MACD(n-1)-MACDSignal(n-1))then alert3:=-n; endif;
next n;
//This looks for histogram crossing up through 0, and when //If histogram crossed up through 0 and continued up, it's a BUY for l = -daysback to 0 step 1 do if (MACD(l)-MACDSignal(l))>0 and (MACD(l-1)-MACDSignal(l-1))<0 and (MACD(0)-MACDSignal(0))>0 and alert1 >0 and histogram>histogramprev then Println Symbol:-5,", ", "Buy : ",close(0):8:3,", "," + Cross "," ,", alert1, " days ago", ",", " + Trend "," ,", alert, " days ago";//count starts with today endif;
if (MACD(l)-MACDSignal(l))>0 and (MACD(l-1)-MACDSignal(l-1))<0 and (MACD(0)-MACDSignal(0))>0 and alert1 = 0 and histogram>histogramprev then Println Symbol:-5,",", "*Buy : ",close(0):8:3,", "," + Cross "," ,", alert1, " days ago", ",", " + Trend "," ,", alert, " days ago";//count starts with today endif;
if (MACD(l)-MACDSignal(l))<0 and (MACD(l-1)-MACDSignal(l-1))>0 and (MACD(0)-MACDSignal(0))<0 and alert2>0 and histogram<histogramprev then Println Symbol:-5,", ", "Sell: ",close(0):8:3,", "," - Cross "," ,", alert2, " days ago", ","," - Trend "," ,", alert3, " days ago";//count starts with today endif;
if (MACD(l)-MACDSignal(l))<0 and (MACD(l-1)-MACDSignal(l-1))>0 and (MACD(0)-MACDSignal(0))<0 and alert2 = 0 and histogram<histogramprev then Println Symbol:-5,",", "*Sell: ",close(0):8:3,", "," - Cross "," ,", alert2, " days ago", ","," - Trend "," ,", alert3, " days ago";//count starts with today endif;
next l; |