Here's the sell signal for BPS (Brooke's Penurious System), translated into the language of QP. It's not as complicated as it looks. In Window on Wall Street, it's simply:
fml("DNS")<4 and slope(fml("Dahl's primary trend"),13)<0 and std(c,21,2)>.25
"Std" is standard deviation, a measure of volatility, and it's in the formula to prevent a lot of sell signals during times of low volatility -- to prevent you from getting whipsawed, in other words. It makes a nice little addition to a lot of formulas for sell signals.
The translation from WOW to QP isn't quite exact. Standard deviation is a little different, and DNS in QP is SARless. But this is my best effort so far to translate the sell signal in BPS. Watch out for line breaks -- there are some long lines, and any breaks picked up in transit will have to be removed, or you'll get errors.
As I've said, BPS isn't the Holy Grail. It may not even be a Dixie cup. In fact, this translation may not even hold water. But it runs, oddly enough.
//Brooke's Percentage System, Sell Signal, //to use with Buy Signal for percentage gain in price. //Based on Bob Jagow's QP formula for linear regreession slope; //Paul Beattie's QP formula for DNS; //Brooke's QP formula for Dahl's Primary Trend; and StDev.
Output="dns.lst"; input="portfoli.lst";
DaysToLoad=250; Integer D, i, S, Sx, Sxx; Float A0,A1,A2,A3,A4,A5,A6,A7,A8, aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk, ll, mm, nn, oo, pp, qq, rr, ss, tt, uu, vv, ww, xx, yy, zz, dahl, dahla, dahlb, dahlc, dahld, dahle, dahlf, dahlg, dahlh, dahli, dahlj, dahlk, dahll, dalslope, Sxy, Sy;
A8:=(wMovavg(-8,8,cl)-wMovavg(-8,17,cl))*1; // Multiplied to make a weighted MA A7:=(wMovavg(-7,8,cl)-wMovavg(-7,17,cl))*2; // Multiplied to make a weighted MA A6:=(wMovavg(-6,8,cl)-wMovavg(-6,17,cl))*3; // Multiplied to make a weighted MA A5:=(wMovavg(-5,8,cl)-wMovavg(-5,17,cl))*4; // Multiplied to make a weighted MA A4:=(wMovavg(-4,8,cl)-wMovavg(-4,17,cl))*5; // Multiplied to make a weighted MA A3:=(wMovavg(-3,8,cl)-wMovavg(-3,17,cl))*6; // Multiplied to make a weighted MA A2:=(wMovavg(-2,8,cl)-wMovavg(-2,17,cl))*7; // Multiplied to make a weighted MA A1:=(wMovavg(-1,8,cl)-wMovavg(-1,17,cl))*8; // Multiplied to make a weighted MA A0:=(wMovavg(0,8,cl)-wMovavg(0,17,cl))*9; // Multiplied to make a weighted MA
D:=0; // 5 day WMA is greater than the 13 day WMA If wMovavg(0,5,cl)>wMovavg(0,13,cl) then D := D +1; endif; // 13 day WMA is greater than the 40 day WMA If wMovavg(0,13,cl)>wMovavg(0,40,cl)then D := D +1; endif; // 50 day MA is greater than the 50 day MA 15 days ago If Movavg(0,50,cl)-Movavg(-15,50,cl)>0 then D := D +1; endif; // OBV greater than its 40 day simple moving average If OBV(0)>Movavg(0,40,OBV) then D := D+1; endif; // Vol greater than 120 day simple moving average If Vol(0)>Movavg(0,120,Vol) then D := D+1; endif; // Divided by 45 for weighted moving average If wMovavg(0,8,cl)-wMovavg(0,17,cl)>(A0+A1+A2+A3+A4+A5+A6+A7+A8)/45 then D:= D + 1; endif; // If((Mov(ROC(C,12,%),3,E)>=-6 OR ROC(C,12,%)>0),1,0)+1,0) If wMovavg(0,3,ROC) >=-6 or ROC(0)>0 then D := D+1; endif;
aa := movavg(0,50,cl) ; bb := movavg(-15,50,cl) ; cc := movavg(-1,50,cl) ; dd := movavg(-16,50,cl) ; ee := movavg(-2,50,cl) ; ff := movavg(-17,50,cl) ; gg := movavg(-3,50,cl) ; hh := movavg(-18,50,cl) ; ii := movavg(-4,50,cl) ; jj := movavg(-19,50,cl) ; kk := movavg(-5,50,cl) ; ll := movavg(-20,50,cl) ; mm := movavg(-6,50,cl) ; nn := movavg(-21,50,cl) ; oo := movavg(-7,50,cl) ; pp := movavg(-22,50,cl) ; qq := movavg(-8,50,cl) ; rr := movavg(-23,50,cl) ; ss := movavg(-9,50,cl) ; tt := movavg(-24,50,cl) ; uu := movavg(-10,50,cl) ; vv := movavg(-25,50,cl) ; ww := movavg(-11,50,cl) ; xx := movavg(-26,50,cl) ; yy := movavg(-12,50,cl) ; zz := movavg(-27,50,cl) ;
dahl := (aa-bb); //dahl(0) dahla := (cc-dd); //dahl(-1) dahlb := (ee-ff); //dahl(-2) dahlc := (gg-hh); //dahl(-3) dahld := (ii-jj); //dahl(-4) dahle := (kk-ll); //dahl(-5) dahlf := (mm-nn); //dahl(-6) dahlg := (oo-pp); //dahl(-7) dahlh := (qq-rr); //dahl(-8) dahli := (ss-tt); //dahl(-8) dahlj := (uu-vv); //dahl(-10) dahlk := (ww-xx); //dahl(-11) dahll := (yy-zz); //dahl(-12)
S := 13; Sx := 0; Sxx := 0; //Sxy := 0; //Sy := 0; for i = 1 - S to 0 do Sx := Sx + i; Sy := dahl + dahla + dahlb + dahlc + dahld + dahld + dahle + dahlf + dahlg + dahlh + dahli +dahlj + dahlk + dahll; Sxx := Sxx + i*i; Sxy := (0*dahl)+(-1*dahla)+(-2*dahlb)+(-3*dahlc)+(-4*dahld)+(-5*dahle)+(-6*dahlf)+(-7*dahlg)+(-8*dahlh)+(-9*dahli)+(-10*dahlj)+(-11*dahlk)+(-12*dahll); next i; dalslope := (S*Sxy - Sx*Sy)/(S*Sxx - Sx*Sx);
if D<=3 and dalslope<0 and StDev(0,-20)>.25 then println symbol:-6," SELL: Close: ", close(0):-6:3, ",", " Up/Down: ", close(0)-close(-1):4:3, ","," Volume: ", vol(0):-10, ",", " QRS: ", QRS(0):2, ","," Sharesfloat: ", Sharesfloat:6:3, ", ",Description:-12; endif;
|