1、日周MACD,新办法日周同图显示 {日周MACD} 周放大数:=0.8;下移周期:=1;日缩小数:=1; DIF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIF,9); MACD:=(DIF-DEA)*2; QJZXZ:=CONST(MIN(CONST(LLV(DIF,下移周期)),CONST(LLV(MACD,下移周期)))); DRAWGBK(C>1,RGB(0,0,0),RGB(1,1,1),1,0,0); {====================MACD过前高=======================} QGZSJ1:=BARSLAST(CROSS(0,MACD)); QGZSJ2:=IF(MACD<0 AND ISLASTBAR,SUMBARS(CROSS(MACD,0),1),SUMBARS(CROSS(MACD,0),2)); ZDZ:=CONST(FINDHIGH(MACD,QGZSJ1,QGZSJ2-QGZSJ1,1)); ZDZSJ:=CONST(FINDHIGHBARS(MACD,QGZSJ1,QGZSJ2-QGZSJ1,1)); HX:=DRAWLINE(ZDZ=MACD,MACD,REF(ZDZ=MACD,1),REF(MACD,1),1); NOTEXTQ22:IF(CURRBARSCOUNT<=ZDZSJ+1,HX,DRAWNULL),COLORYELLOW,DOTLINE; NOTEXTQ23:IF(CURRBARSCOUNT<=ZDZSJ+1,NOTEXTQ22*1.38,DRAWNULL),COLORBLACK,POINTDOT; DRAWTEXT(ISLASTBAR,NOTEXTQ22,STRCAT(' ',CON2STR(NOTEXTQ22,2))),COLORYELLOW; DRAWTEXT(CURRBARSCOUNT=ZDZSJ+1,MACD,'前横线'),COLORYELLOW,DRAWABOVE; {=====================================================} SCSJ:=CONST(BARSLAST(DIF<REF(DIF,1) AND REF(DIF,1)>REF(DIF,2)))+1; NOTEXTSCHX:IF(CURRBARSCOUNT<=SCSJ+1,CONST(REF(DIF,SCSJ)),DRAWNULL),COLORGREEN,DOTLINE; DRAWICON(CROSS(DIF,NOTEXTSCHX),NOTEXTSCHX,1); {=============================} 日DIF:DIF,COLORWHITE,NODRAW; 日DEA:DEA,COLORMAGENTA,NODRAW; 日MACD:MACD,COLORRED,NODRAW; STICKLINE(日MACD>0,日MACD*日缩小数,0,0,0),COLORRED; STICKLINE(日MACD<0,日MACD*日缩小数,0,0,0),COLORCYAN; NOTEXTDIF:日DIF*日缩小数,COLORWHITE; NOTEXTDEA:日DEA*日缩小数,COLORMAGENTA; {=============================} 下移线1:=0.1; 周DIF:EMA(CLOSE,12*5)-EMA(CLOSE,26*5),COLORWHITE,NODRAW; 周DEA:EMA(周DIF,9*5),COLORMAGENTA,NODRAW; 周MACD:(周DIF-周DEA)*2,COLORRED,NODRAW; MACD转换1:=周MACD*周放大数+下移线1; T22:=周DIF*周放大数+下移线1; QJZDZ:=CONST(MAX(CONST(HHV(T22,下移周期)),CONST(HHV(MACD转换1,下移周期)))); {=============================} 下移线2:=-(ABS(QJZXZ)+ABS(QJZDZ)); {=============================} MACD转换2:=周MACD*周放大数+下移线2; STICKLINE(周MACD>0,MACD转换2,下移线2,0,1),COLORRED; STICKLINE(周MACD<0,MACD转换2,下移线2,0,1),COLORCYAN; NOTEXT22:周DIF*周放大数+下移线2,COLORMAGENTA; NOTEXT33:周DEA*周放大数+下移线2,COLORWHITE; DRAWTEXT_FIX(1,0,0,0,'███████'),COLORYELLOW; DRAWTEXT_FIX(1,0,0,0,' 日线MACD'),COLORRED; DRAWTEXT_FIX(1,0,0.53,0,'███████'),COLORYELLOW; DRAWTEXT_FIX(1,0,0.53,0,' 周线MACD'),COLORRED; 2、仓位比例提示 {仓位比例提示} DRAWRECTREL(0,5,1000,1,RGB(200,300,500)); DRAWRECTREL(0,202,1000,195,RGB(0,50,50)); DRAWRECTREL(0,498,1000,495,RGB(100,500,300)); DRAWRECTREL(0,808,1000,800,RGB(00,50,50)); DRAWRECTREL(0,1000,1000,995,RGB(200,300,500)); N:=100000; 历史最高价:=HHV(H,0),COLORRED; A:=历史最高价; 建仓百分之:=(A-C)/A*100*1,COLORWHITE; 分仓后每份资金:=N,COLORMAGENTA; 本份资金应买额:=(N*(A-C)/A)*1,COLORGREEN; 本份资金应买股:=INTPART((本份资金应买额/C)/100)*100,COLORYELLOW; 仓位比例:INTPART(EMA(建仓百分之,15)/2.5)*2.5,COLORRED,LINETHICK3; {持仓比例:=STRCAT(STRCAT('仓位比例: ',CON2STR(仓位比例,2)),'%'); DRAWTEXT_FIX(ISLASTBAR,0.3,0.001,0,持仓比例),COLORWHITE;} DRAWTEXT_FIX(ISLASTBAR=1,0.01,0,0,STKNAME),COLORYELLOW; DRAWTEXT_FIX(ISLASTBAR=1,0.09,0,0,CODE),COLORWHITE; {黄金分割 普通 等系坐标} DRAWRECTREL(990,2,998,188,RGB(0,150,180)),NOFRAME; DRAWRECTREL(990,188,998,375,RGB(200,200,0)),NOFRAME; DRAWRECTREL(990,375,998,491,RGB(100,200,0)),NOFRAME; DRAWRECTREL(990,491,998,607,RGB(200,10,80)),NOFRAME; DRAWRECTREL(990,607,998,794,RGB(150,0,0)),NOFRAME; DRAWRECTREL(990,794,998,982,RGB(150,150,150)),NOFRAME; {股民学院 www.58188.com 整理} 3、蜡烛图战法 {蜡烛图战法 源码} 上开:=O; 上收:=C; 上高:=H; 上低:=L; 箱顶:MA(REF(HHV(上收,30),1),2),COLOR0000FF,LINETHICK2; 箱底:MA(REF(LLV(上收,30),1),2),COLOR00FF00,LINETHICK2; 多空:EMA((EMA(CLOSE,29)+EMA(CLOSE,31)+EMA(CLOSE,33))/3,3),COLORYELLOW,LINETHICK3; 做空:=REF(多空,1),COLORGREEN,NODRAW; A2:=EMA(多空,25)COLORLIBLUE,LINETHICK3; A1X:=(多空-REF(多空,1))/REF(多空,1)*100,NODRAW; A2X:=(A2-REF(A2,1))/REF(A2,1)*100,NODRAW; 买:IF(A1X>=0,多空,DRAWNULL),COLORMAGENTA,LINETHICK3; 卖:IF(A1X<0 AND A2X<0,多空,DRAWNULL),COLORGREEN,LINETHICK3; |