您現(xiàn)在的位置: 南方財富網(wǎng) >> 股票知識 >> 股票公式 >> 正文
南財搜索

飛狐股票公式之MACD

2012/8/23 16:08:05   來源:本站原創(chuàng)   佚名
    

  飛狐股票公式之MACD

  input: P(19,15,100), S(7,5,140), M(9,2,80);

  {-----------------------☆功能開關(guān)------------------------}

  {資金}

  ZJ1:=DMA((H+L+C*2)/4,0.9); ZJ2:=V/((H-L)*2-ABS(C-O));

  ZJ3:=IF(C》O,ZJ2*(H-L),IF(C《O,ZJ2*(H-O+(C-L)),V/2))+IF(C》O,0-ZJ2*(H-C+(O-L)),IF(C《O,0-ZJ2*(H-L),0-V/2));

  ZJ4:=ZJ3/20/1.15; ZJ5:=ZJ4*0.55+REF(ZJ4,1)*0.33+REF(ZJ4,2)*0.22; ZJ6:=EMA(ZJ5,3);

  {macd}

  MJ_1 := EMA(CLOSE,S) - EMA(CLOSE,P);

  MJ_2 := EMA(MJ_1,M);

  MJ_3 := 2*(MJ_1-MJ_2);

  MJ_4:=REVERSE(MJ_3)+2*WMA(WMA(MJ_3,1),5);

  MJ_5:=3*MJ_4-2*SMA(MJ_4,2,1);

  {形態(tài)}

  低金:=CROSS(MJ_1,MJ_2) AND MJ_1《-0.1;{低金}

  SA0:=COUNT(CROSS(MJ_1,MJ_2) AND MJ_2《0,21)=3;

  零下二次金叉:=CROSS(MJ_3,0) and SA0;{零下二次金叉}

  SA1:=COUNT(CROSS(MJ_1,MJ_2),BARSLAST(MJ_2》=0));

  二金:=(CROSS(MJ_1,MJ_2) AND MJ_2《0 AND COUNT(SA1=2,21)=1)*2;{二次金叉}

  SA2:=BARSLAST(REF(CROSS(MJ_1,MJ_2),1));

  底背:=(REF(C,SA2+1)》C AND MJ_1》REF(MJ_1,SA2+1) AND CROSS(MJ_1,MJ_2))*3;{底背}

  三全:=低金 AND 二金 AND 底背;

  SA3:=BARSLAST(REF(CROSS(MJ_2,MJ_1),1));

  頂背:=REF(C,SA3+1)《C AND REF(MJ_1,SA3+1)》MJ_1 AND CROSS(MJ_2,MJ_1);{頂背}

  {信號}

  M_C1:=EMA(C,5)/EMA(EMA(C,9),16)《=0.85 and c/ref(c,1)《1.05 and c/ref(c,1)》0.905 and V/CAPITAL*100《5;

  M_C2:=MIN(ref(C,2)*0.865,ref(c,13)*0.772); M_C3:=(C-M_C2)/C《0.03; 滿倉:=M_C1 and M_C3;

  {估測轉(zhuǎn)折股價--未來}

  X:=BarsLast(Backset(ISLASTBAR,1)=1)+1;

  Z_1:=REF(MJ_2,1)+((M+1)/(2*(M-1)))*REF(MJ_3,1);

  Z_2:=((P-1)*(S+1)*REF(EMA(C,P),1)-(P+1)*(S-1)*REF(EMA(C,S),1)+(S+1)*(P+1)*REF(MJ_1,1))/(2*P-2*S);

  Z_3:=((P-1)*(S+1)*REF(EMA(C,P),1)-(P+1)*(S-1)*REF(EMA(C,S),1)+(S+1)*(P+1)*REF(MJ_2,1))/(2*P-2*S);

  Z_4:=((P-1)*(S+1)*REF(EMA(C,P),1)-(P+1)*(S-1)*REF(EMA(C,S),1)+(S+1)*(P+1)*Z_1)/(2*P-2*S);

  Y_1:=(MJ_2*X+((M+1)/(2*(M-1)))*MJ_3*X);

  Y_2:=((P-1)*(S+1)*EMA(C,P)*X-(P+1)*(S-1)*EMA(C,S)*X+(S+1)*(P+1)*MJ_1*X)/(2*P-2*S);

  Y_3:=((P-1)*(S+1)*EMA(C,P)*X-(P+1)*(S-1)*EMA(C,S)*X+(S+1)*(P+1)*MJ_2*X)/(2*P-2*S);

  Y_4:=((P-1)*(S+1)*EMA(C,P)*X-(P+1)*(S-1)*EMA(C,S)*X+(S+1)*(P+1)*Y_1)/(2*P-2*S);

  {-----------------【圖解模板】---------------------}

  DRAWGBK(C,COLORRGB(36,68,36),COLORRGB(100,100,100),1);

  {MACD}

  FILLRGN(MJ_1》=MJ_2,MJ_1,MJ_2),Color689AFF;

  FILLRGN(MJ_1《MJ_2,MJ_2,MJ_1),ColorFFC000;

  FILLRGN(MJ_3》MJ_5,MJ_5,MJ_3),ColorFFB7FF;

  FILLRGN(MJ_3《MJ_5,MJ_5,MJ_3),Color003E00;

  STICKLINE(MJ_3《ref(MJ_3,1) and MJ_3《0,0,MJ_3,0,0),ColorFFCF78;{藍}

  STICKLINE(MJ_3《ref(MJ_3,1) and MJ_3》0,0,MJ_3,0,0),COLORYELLOW;{黃}

  STICKLINE(MJ_3》ref(MJ_3,1) and MJ_3《0,0,MJ_3,0,0),ColorAF00AF;{紫}

  STICKLINE(MJ_3》ref(MJ_3,1) and MJ_3》0,0,MJ_3,0,0),COLORRED;{紅}

  DIFF: MJ_1,PRECISION2,COLORWHITE;

  DEA: MJ_2,PRECISION2,COLORYELLOW;

  加速:2.8*(MJ_2-MJ_1),LINETHICK,PRECISION2,COLORGREEN;

  PARTLINE(RANGE(BARPOS,SYSPARAM(3)-34,SYSPARAM(3)+1),加速),LINEDOT,COLORGREEN;

  多頭: MJ_3,LINETHICK2,PRECISION2,COLORRED;

  預(yù)警:MJ_5,PRECISION2,ColorFF8900,ColorFFB500;

  PARTLINE(MJ_1》=REF(MJ_1,1) AND MJ_2《REF(MJ_2,1),MJ_1),LINETHICK2,COLORMAGENTA;//粉

  PARTLINE(MJ_1《REF(MJ_1,1) AND MJ_2》REF(MJ_2,1),MJ_1),LINETHICK2,COLORBLUE;//藍

  {資金}

  PARTLINE(1,0),LINETHICK2,COLORWHITE;//負

  PARTLINE(ZJ6》=0,0),LINETHICK2,COLORRED;//正

  {形態(tài)}

  DRAWTEXT(低金,DEA*0.98,‘▲’),PXDN8,Color00C300;

  DRAWTEXT(零下二次金叉,DEA*0.98,‘▲ \n▲’),PXDN8,Color00C300;

  DRAWTEXT(二金,DEA*0.98,‘▲ \n▲’),PXDN8,Color00C300;

  DRAWTEXT(底背,DEA*0.98,‘ \n \n↑’),PXDN8,COLORMAGENTA;

  DRAWTEXT(三全,DEA*0.98,‘▲ \n▲ \n▲’),PXDN8,COLORRED;

  DRAWTEXT(頂背,DEA,‘▼ \n▼’),PXUP60,ColorFF5B00;

  {信號}

  VERTLINE(滿倉),LINEDOT,COLORGRAY;

  DRAWTEXT(滿倉,加速,‘ 第 \n 二 \n 天 \n 買 \n’),ALIGN,COLORYELLOW;

  DRAWICON(滿倉,MJ_1*0.96,1),ALIGN,PXDN10;//多空差:34.47 成功率:83.08%

  {估測轉(zhuǎn)折股價--未來}

  DRAWTEXTEX(sysparam(3)=BARPOS,0,6,2,‘今日DIFF轉(zhuǎn)折: ’+NUMTOSTR(Z_2,2)),COLORGREEN;

  DRAWTEXTEX(sysparam(3)=BARPOS,0,6,20,‘今日DEA轉(zhuǎn)折: ’+NUMTOSTR(Z_3,2)),COLORGREEN;

  DRAWTEXTEX(sysparam(3)=BARPOS,0,6,38,‘今日MACD轉(zhuǎn)折:’+NUMTOSTR(Z_4,2)),COLORGREEN;

  DRAWTEXTEX(sysparam(3)=BARPOS,0,6,94,‘明日DIFF轉(zhuǎn)折: ’+NUMTOSTR(Y_2,2)),COLORYELLOW;

  DRAWTEXTEX(sysparam(3)=BARPOS,0,6,112,‘明日DEA轉(zhuǎn)折: ’+NUMTOSTR(Y_3,2)),COLORYELLOW;

  DRAWTEXTEX(sysparam(3)=BARPOS,0,6,130,‘明日MACD轉(zhuǎn)折: ’+NUMTOSTR(Y_4,2)),COLORYELLOW;

  換手:if(capital=0,v/sum(v,100)*100,v/FINANCE(7)),PRECISION2,LINETHICK,COLORGRAY;

  漲跌幅:(C-REF(C,1))/REF(C,1)*100,PRECISION2,LINETHICK,COLORGRAY;

  {取參數(shù)}

  GDT2:=FINANCE(0);//報表最新日期

  XXx:=STRTONUM(STRRIGHT(NUMTOSTR(FINANCE(0),0),2));//取右兩位數(shù)

  Nn:=IF(XXx》11 OR XXx《3,1,IF(BETWEEN(XXx,2.9,6),4,IF(BETWEEN(XXx,5.9,9),2,4/3))),LINETHICK;

  市贏率:C/(FINANCE(33)*Nn),PRECISION2,LINETHICK,COLORGRAY;

  市凈率:C/FINANCE(34),PRECISION2,LINETHICK,COLORGRAY;

(南方財富網(wǎng)SOUTHMONEY.COM)
    南方財富網(wǎng)聲明:股市資訊來源于合作媒體及機構(gòu),屬作者個人觀點,僅供投資者參考,并不構(gòu)成投資建議。投資者據(jù)此操作,風險自擔。
延伸閱讀
商務(wù)進行時
每日必讀
學(xué)院24小時排行
證券導(dǎo)讀
熱圖推薦

關(guān)于南方財富網(wǎng) -版權(quán)聲明誠聘英才廣告服務(wù)網(wǎng)站地圖友情鏈接
特此聲明:廣告商的言論與行為均與南方財富網(wǎng)無關(guān)
2dayisday1.com
南方財富網(wǎng) © 版權(quán)所有 閩ICP備09035581號