当前位置: 网站首页 > 股票软件公式 > 同花顺公式 > 文章 当前位置: 同花顺公式 > 文章

同花顺源码精选:MACD波段,MACD加权成交,定量结构

点击: 次    来源:顶尖财经    作者:股市狙击 - 小 + 大

1、MACD波段

改版MACD,调整量能,调整底部位置,调整进出位置,

VAR2Q:=REF(LOW,1);
VAR3Q:=SMA(ABS(LOW-VAR2Q),3,1)/SMA(MAX(LOW-VAR2Q,0),3,1)*100;
VAR4Q:=EMA(IF(CLOSE*1.3,VAR3Q*10,VAR3Q/10),3);
VAR5Q:=LLV(LOW,30);
VAR6Q:=HHV(VAR4Q,30);
VAR7Q:=IF(MA(CLOSE,58),1,0);
VAR8Q:=EMA(IF(LOW<=VAR5Q,(VAR4Q+VAR6Q*2)/2,0),3)/999*VAR7Q;
洗:=IF(VAR8Q>50,50,VAR8Q);
STICKLINE(洗>0,0 ,洗*2,2,0 ),COLOR4444FF;
STICKLINE(洗>0,0 ,洗*2,2,0 ),COLOR5555FF;
STICKLINE(洗>0,0 ,洗*2,2,0 ),COLOR7777FF;
STICKLINE(洗>0,0 ,洗*2,2,0 ),COLOR9999FF;
牛股:IF(BARSLAST(CROSS(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),SMA(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),3,1)))<9 AND BARSLAST(CROSS(SMA(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),3,1),SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)))<9 AND CROSS(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),SMA(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),3,1)) AND SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)<20,90,0),STICK,COLORFF937F;
STICKLINE(牛股,0,95,2,1),LINETHICK2,STICK,COLORFF937F;
BB:=IF(BARSLAST(CROSS(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100))>=3 AND CROSS((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)) AND SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)<30,20,0);
STICKLINE(BB,0,20,4,0),coloryellow;
AA:=IF(BARSLAST(CROSS((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1)))>=4 AND CROSS(SMA((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100,3,1),(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100) AND (CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100>50,20,0);
STICKLINE(AA,80,100,4,0),COLOR00FF00;
VARF2:=TROUGHBARS(3,15,1)<4;
VARF1:=PEAKBARS(3,15,1)<4;
STICKLINE(FILTER(VARF2=1,5),35,0,4,0),coloryellow;
STICKLINE(FILTER(VARF1=1,5),35,0,4,0),colorblue;
VAR2C:=(CLOSE-LLV(LOW,20))/(HHV(HIGH,20)-LLV(LOW,20))*100;
VAR3C:=SMA(SMA(VAR2C,3,1),3,1)/30;
VAR4C:=EMA(VAR3C,5);
VAR5C:=3*VAR3C-2*VAR4C;
AC:=CROSS(VAR5C,VAR3C) AND VAR3C<2.1 AND C>O;
STICKLINE(AC,0,15,6,0),colorcyan;
VAR3:=(CLOSE-MA(CLOSE,6))/MA(CLOSE,6)*100;
VAR4:=(CLOSE-MA(CLOSE,24))/MA(CLOSE,24)*100;
VAR5:=(CLOSE-MA(CLOSE,32))/MA(CLOSE,32)*100;
VAR6:=(VAR3+VAR4+VAR5)/3;
VAR7:=EMA(VAR6,5);
VAR8:=IF(VAR6<=-20,10,0);
VAR9:=HHV(VAR8,10);
STICKLINE(VAR8=10,50,10,4,0),COLOR6666FF;
VARA:=IF(VAR9 AND CROSS(MA(CLOSE,3),MA(CLOSE,5)),20,0);
STICKLINE((VARA=20),0,10,4,0),colorwhite;
VARC:=(ZIG(3,5)>REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)<=REF(ZIG(3,5),2)) AND (REF(ZIG
(3,5),2)<=REF(ZIG(3,5),3));
VARD:=(ZIG(3,5)<REF(ZIG(3,5),1)) AND (REF(ZIG(3,5),1)>=REF(ZIG(3,5),2)) AND (REF(ZIG
(3,5),2)>=REF(ZIG(3,5),3));
STICKLINE((VARC=1),(45),0,4),COLOR0000FF;
STICKLINE((VARD=1),45,0,4),colorgreen;
VARE:=MA(100*(CLOSE-LLV(CLOSE,34))/(HHV(HIGH,34)-LLV(LOW,34)),5)-20;
VARF:=100-3*SMA((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1)+2*SMA(SMA
((CLOSE-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1),15,1);
VAR10:=100-3*SMA((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1)+2*SMA(SMA
((OPEN-LLV(LOW,75))/(HHV(HIGH,75)-LLV(LOW,75))*100,20,1),15,1);
VAR11:=VARF<REF(VAR10,1) AND VOL>REF(VOL,1) AND CLOSE>REF(CLOSE,1);
DRAWTEXT(VAR11 AND COUNT(VAR11,30)=1,90,' '),LINETHICK2,COLORFF00FF;
STICKLINE(VAR11 AND COUNT(VAR11,30)=1,1,25,4,0),COLORFF00FF;
VAR12:=(HIGH+LOW+CLOSE)/3;
VAR13:=(VAR12-MA(VAR12,14))/(0.015*AVEDEV(VAR12,14));
VAR14:=(VAR12-MA(VAR12,70))/(0.015*AVEDEV(VAR12,70));
VAR15:=IF(VAR13>=150 AND VAR13<200 AND VAR14>=150 AND VAR14<200,10,0);
VAR16:=IF(VAR13<=-150 AND VAR13>-200 AND VAR14<=-150 AND VAR14>-200,-10,VAR15);
VAR17:=(CLOSE-MA(CLOSE,13))/MA(CLOSE,13)*100;
VAR18:=100-ABS(VAR17);
VAR19:=IF(VAR18<90,VAR18,100);V1:=ZIG(3,12);
VAR001:=ZIG(3,12)<REF(ZIG(3,12),1) AND REF(ZIG(3,12),1)>REF(ZIG(3,12),2);
VAR002:=ZIG(3,12)>REF(ZIG(3,12),1) AND REF(ZIG(3,12),1)<REF(ZIG(3,12),2);
VAR003:=IF(TROUGHBARS(3,16,1)=0 AND HIGH>LOW+0.04,4,0);
买点:= VAR003,colorred;
STICKLINE(买点,0,35,5,0),coloryellow,LINETHICK2;
RSV1:=(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34))*110;
D:SMA(SMA(RSV1,9,1),5,1),colorffffff,LINETHICK2;
J:3*SMA(RSV1,9,1)-2*D,coloryellow,LINETHICK1;
STICKLINE(J>REF(J,1),J,REF(J,1),4,0),colorred;
STICKLINE(J<REF(J,1),HHV(J,3),LLV(J,3),3,0),colorgreen;
STICKLINE(J<REF(J,1),J,REF(J,1),3,0),colorgreen;
量:=(CLOSE - LLV(LOW,32)) / (HHV(HIGH,32) - LLV(LOW,32)) * 1.2 * CLOSE;
量1:=EMA(量,3);
量2:=EMA(量,5);
RSV:=(CLOSE-LLV(LOW,34))/(HHV(HIGH,34)-LLV(LOW,34))*110;
K:=SMA(RSV,9,1);
D:=SMA(K,5,1);
J:=3*K-2*D;



2、MACD加权成交,上穿0轴买入

//MACD加权成交 上穿0轴买入( 股民学院: http://www.58188.com )

大单额:=(BIGBUYCOUNT1+WAITBUYCOUNT1)-(BIGSELLCOUNT1+WAITSELLCOUNT1);
五日大单量:100*(WMA(大单额,12)-WMA(大单额,26)),colorwhite;
九日大单量:(WMA(五日大单量,9)),coloryellow;
MACD:=10*((BIGBUYCOUNT1+BIGBUYCOUNT2)-(BIGSELLCOUNT1+BIGSELLCOUNT2));
STICKLINE(MACD>0,0,MACD,8),color0000ff;
STICKLINE(MACD<0,0,MACD,8),color00ff00;
gj:=MAX(C,O);
L4:=LLV(gj,4);
jl:=(HHV(五日大单量,55)-LLV(五日大单量,55))/5;
gt:=九日大单量>REF(九日大单量,1) AND REF(九日大单量,1)<REF(九日大单量,2);
A1:=BARSLAST(REF(gt,1));
底部结构:=REF(L4,A1+1)>CLOSE AND 五日大单量>REF(五日大单量,A1+1) AND gt;
DRAWLINE(A1=0,九日大单量,底部结构,REF(九日大单量,A1),0),colorred,LINETHICK2;
DRAWLINE(底部结构,九日大单量,底部结构,REF(九日大单量,A1),0),colorred,LINETHICK2;
DRAWTEXT(底部结构,REF(九日大单量,A1)*1.18,' 底部结构'),colorred;
H4:=HHV(gj,4);
gt2:=九日大单量<REF(九日大单量,1) AND REF(九日大单量,1)>REF(九日大单量,2);
A2:=BARSLAST(REF(gt2,1));
顶部结构:= REF(H4,A2+1)<H4 AND 五日大单量<REF(五日大单量,A2+1) AND gt2;
DRAWLINE(A2=0 ,九日大单量,顶部结构,REF(九日大单量,A2),0),colorgreen,LINETHICK2;
DRAWLINE(顶部结构,九日大单量,顶部结构,REF(九日大单量,A2),0),colorgreen,LINETHICK2;
DRAWTEXT(顶部结构,REF(九日大单量,A2)*1.18,' 顶部结构'),colorgreen;
A0:=五日大单量<0 AND 九日大单量<0;
A11:=A0>REF(A0,1);
A3:=BARSLAST(A11);
A4:=COUNT(九日大单量>0 AND 五日大单量>0,A3)=0;
A5:=CROSS(五日大单量 ,九日大单量);
A6:=BARSLAST(A5);
A7:=REF(A6,A6+1)+A6;
A8:=(五日大单量+九日大单量)/2;
A9:=(HIGH+LOW)/2;
A10:=A5 AND A7<A3 AND A4 AND A8>REF(A8,A7) AND A9<REF(A9,A7) AND MACD>0;
KDJ;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,9,3),colorwhite;
D:SMA(K,9,3),colorcyan;
J:3*K-2*D,colormagenta;
A2:=BARSLAST(REF(CROSS(K,D),1));
B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);
A3:=BARSLAST(REF(CROSS(D,K),1));
B3:=REF(C,A2+1)<C AND REF(K,A2+1)>K AND CROSS(D,K);
A22:=IF(ABS(D)<ABS(0.6*九日大单量),0.6*D*ABS(九日大单量/D),0.95*D);
DRAWTEXT(B2,A22,'KDJ底背离'),colorwhite;
DRAWICON(b2,d,'buy');
DRAWICON(B3,D,'SELL');
DRAWTEXT(B3,A22,'KDJ顶背离'),colorgreen;
r1:=CROSS(J,D) AND D>=REF(D,1);
R2:=CROSS(J,D) AND D>=REF(D,1) AND (C-REF(C,1))/REF(C,1)>0.035;
DRAWTEXT(R2 AND r1<30,-10,'KDJ金叉'),colorred;



3、定量结构同花顺版本 徐小明老师的公式

定量结构( 股民学院: http://www.58188.com )

DIF:100*(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
死叉:=CROSS(DEA,DIF);
N1:=BARSLAST(死叉);
N2:=REF(BARSLAST(死叉),N1+1);
N3:=REF(BARSLAST(死叉),N2+N1+2);
CL1:=LLV(C,N1+1);
DIFL1:=LLV(DIF,N1+1);
CL2:=REF(CL1,N1+1);
DIFL2:=REF(DIFL1,N1+1);
CL3:=REF(CL2,N1+1);
DIFL3:=REF(DIFL2,N1+1);
PDIFL2:=IF(DIFL2>0,INTPART(LOG(DIFL2))-1,INTPART(LOG(-DIFL2))-1);
MDIFL2:=INTPART(DIFL2/POW(10,PDIFL2));
PDIFL3:=IF(DIFL3>0,INTPART(LOG(DIFL3))-1,INTPART(LOG(-DIFL3))-1);
MDIFL3:=INTPART(DIFL3/POW(10,PDIFL3));
MDIFB2:=INTPART(DIF/POW(10,PDIFL2));
MDIFB3:=INTPART(DIF/POW(10,PDIFL3));
直接底背离:=(CL1<CL2 ) AND (MDIFB2>MDIFL2) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB2<=REF(MDIFB2,1);
隔峰底背离:=(CL1<CL3 AND CL3<CL2 ) AND (MDIFB3>MDIFL3) AND (MACD<0 AND REF(MACD,1)<0) AND MDIFB3<=REF(MDIFB3,1);
B:=(直接底背离 OR 隔峰底背离);
BG:=((MDIFB2>REF(MDIFB2,1))*REF(直接底背离,1)) OR ((MDIFB3>REF(MDIFB3,1))*REF(隔峰底背离,1));
底背离消失:=(REF(直接底背离,1) AND DIFL1<=DIFL2 ) OR (REF(隔峰底背离,1) AND DIFL1<=DIFL3);
STICKLINE(B OR BG,DIF,DEA,8,0),colorred;
DRAWTEXT((B AND COUNT(B,2)=1),(DIF*1.5),'钝化'),coloryellow;
DRAWTEXT(FILTER(BG,10),(DIF*1.5),'结构形成'),colormagenta;
DRAWTEXT(FILTER(底背离消失,10),(DIF+MACD),'消失'),colorgreen;
STICKLINE(BG,0,(DIF+DEA),5,0), colorred;
金叉:=CROSS(DIF,DEA);
M1:=BARSLAST(金叉);
M2:=REF(BARSLAST(金叉),M1+1);
M3:=REF(BARSLAST(金叉),M2+M1+2);
CH1:=HHV(C,M1+1);
DIFH1:=HHV(DIF,M1+1);
CH2:=REF(CH1,M1+1);
DIFH2:=REF(DIFH1,M1+1);
CH3:=REF(CH2,M1+1);
DIFH3:=REF(DIFH2,M1+1);
PDIFH2:=IF(DIFH2>0,INTPART(LOG(DIFH2))-1,INTPART(LOG(-DIFH2))-1);
MDIFH2:=INTPART(DIFH2/POW(10,PDIFH2));
PDIFH3:=IF(DIFH3>0,INTPART(LOG(DIFH3))-1,INTPART(LOG(-DIFH3))-1);
MDIFH3:=INTPART(DIFH3/POW(10,PDIFH3));
MDIFT2:=INTPART(DIF/POW(10,PDIFH2));
MDIFT3:=INTPART(DIF/POW(10,PDIFH3));
直接顶背离:=(CH1>CH2 ) AND (MDIFT2<MDIFH2) AND (MACD>0 AND REF(MACD,1)>0) AND MDIFT2>=REF(MDIFT2,1);
隔峰顶背离:=(CH1>CH3 AND CH3>CH2 ) AND (MDIFT3<MDIFH3) AND (MACD>0 AND REF(MACD,1)>0) AND MDIFT3>=REF(MDIFT3,1);
T:=(直接顶背离 OR 隔峰顶背离);
TG:=((MDIFT2<REF(MDIFT2,1))*REF(直接顶背离,1)) OR ((MDIFT3<REF(MDIFT3,1))*REF(隔峰顶背离,1));
顶背离消失:=(REF(直接顶背离,1) AND DIFH1>=DIFH2 ) OR (REF(隔峰顶背离,1) AND DIFH1>=DIFH3);
STICKLINE(TG,0,(DIF+DEA),5,0), colorgreen;
STICKLINE(T OR TG,DIF,DEA,8,0),colorgreen;
DRAWTEXT(FILTER(TG,20),(DIF*1.4),'结构形成'),colormagenta;
DRAWTEXT(FILTER(顶背离消失,20),(DIF+MACD),'消失'),colorgreen;

上一篇:同花顺公式下载:寻庄出击AA

下一篇:同花顺源码精选:点将台,买卖准确,我的均线系统