以下是指标公式大全源码和截图
缠论指标公式大全源码:
SHORT:=7;LONG:=19;
MA5:MA(CLOSE,5);
MA13:MA(CLOSE,13);
MA21:MA(CLOSE,21);
MA34:MA(CLOSE,34);
MA55:MA(CLOSE,55);
MA89:MA(CLOSE,89);
MA144:MA(CLOSE,144);
MA233:MA(CLOSE,233);
T:=PERIOD;
D:=IF(T=0,30,{1F}
IF(T=1,25,{5F}
IF(T=8,25,{多分钟}
IF(T=2,20,{15F}
IF(T=3,20,{30F}
IF(T=4,20,{60F}
IF(T=5,10,{日}
IF(T=6,10,{周}
IF(T=7,10,{月}
IF(T=9,10,{多日}
IF(T=10,10{季},10{年})))))))))));
RMA:=EMA(CLOSE,SHORT),COLORLIGRAY;
NMA:=EMA(CLOSE,LONG),COLORMAGENTA;
RISK:=IF(NMA RMA,NMA,DRAWNULL),COLORGREEN;
DRAWLINE(L=LLV(L,BARSLAST(CROSS(NMA,RMA))+1)ANDL=LLV(L,D)ANDRMA =NMA,L,H=HHV(H,BARSLAST(CROSS(RMA,NMA))+1)ANDH=HHV(H,D)ANDRMA =NMA,H,0),COLOR0000FF,LINETHICK2;
DRAWLINE(H=HHV(H,BARSLAST(CROSS(RMA,NMA))+1)ANDH=HHV(H,D)ANDRMA =NMA,H,L=LLV(L,BARSLAST(CROSS(NMA,RMA))+1)ANDL=LLV(L,D)ANDRMA =NMA,L,0),COLOR238E23,LINETHICK2;
重心线:=(H+L+O+C*3)/6;
{DRAWGBKLAST(V 1,STRIP(RGB(60,10,0),RGB(10,50,0),0));}
NX:=(3*CLOSE+LOW+OPEN+HIGH)/6;
牛线:=(20*NX+19*REF(NX,1)+18*REF(NX,2)+17*REF(NX,3)+16*REF(NX,4)
+15*REF(NX,5)+14*REF(NX,6)+13*REF(NX,7)+12*REF(NX,8)+11*REF(NX,9)
+10*REF(NX,10)+9*REF(NX,11)+8*REF(NX,12)+7*REF(NX,13)+6*REF(NX,14)
+5*REF(NX,15)+4*REF(NX,16)+3*REF(NX,17)
+2*REF(NX,18)+REF(NX,20))/210;
{牛熊线:MA(牛线,6),COLORGREEN,LINETHICK2;}
牛熊线:=MA(牛线,6);{,COLORLIGREEN,LINETHICK1;}
{DRAWBAND(重心线,RGB(168,18,38),牛熊线,RGB(10,100,200));}
简底:=H REF(H,1)ANDREF(H,1) REF(H,2)ANDL REF(L,1)ANDREF(L,1) REF(L,2);
简顶:=H REF(H,1)ANDREF(H,1) REF(H,2)ANDL REF(L,1)ANDREF(L,1) REF(L,2);
包含1:=REF(H,1) =REF(H,2)ANDREF(L,1) =REF(L,2);
包含2:=REF(H,1) =REF(H,2)ANDREF(L,1) =REF(L,2);
包底1:=H REF(H,2)ANDREF(H,2) REF(H,3)ANDL REF(L,1)ANDREF(L,1) REF(L,3);
包底2:=H REF(H,1)ANDREF(H,1) REF(H,3)ANDL REF(L,2)ANDREF(L,2) REF(L,3);
包顶1:=H REF(H,1)ANDREF(H,1) REF(H,3)ANDL REF(L,2)ANDREF(L,2) REF(L,3);
包顶2:=H REF(H,2)ANDREF(H,2) REF(H,3)ANDL REF(L,1)ANDREF(L,1) REF(L,3);
复底:=IF(包含1,包底1,IF(包含2,包底2,简底));
复顶:=IF(包含1,包顶1,IF(包含2,包顶2,简顶));
底分型:=IF(BARSLAST(CROSS(牛熊线,重心线)) 3,FILTER(BACKSET(FILTER(复底AND重心线 牛熊线,3),2),1),0);
顶分型:=IF(BARSLAST(CROSS(重心线,牛熊线)) 3,FILTER(BACKSET(FILTER(复顶AND重心线 牛熊线,3),2),1),0);
{
DRAWICON(底分型,L,1);
DRAWICON(顶分型,H,2);
}
{******************************************************************************************}
局部低点预选A:=BACKSET(LLV(L,5) REF(LLV(L,4),1),4);
局部低点预选B:=BACKSET(局部低点预选A=0ANDREF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1ANDREF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5) REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0ANDREF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1ANDREF(局部高点预选B,1)=0,1,0);
判断:=IF(L REF(H,1),1,IF(H REF(L,1),-1,0));
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOWRANGE(L);
大值周期:=TOPRANGE(H);
低保留AA:=IF(局部低点预选C=-1ANDREF(距前高天,1) REF(距前低天,1)ANDLLV(L,距前高天+1) REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1ANDREF(距前高天,1) =REF(距前低天,1)AND(距前高天 =4ORLLV(缺口判断,距前高天)=-1ORLLV(L,距前低天+2) REF(LLV(L,距前低天+1),1)),-1,0);
低保留S:=IF((低保留AA=-1OR低保留AB=-1)ANDL REF(H,距前高天+1),-1,0);
预判:=IF((距前低天 4ANDHHV(缺口判断,距前低天)!=1)ORREF(低保留S,距前低天)=0,1,0);
判断:=IF(局部高点预选C=1ANDREF(距前低天,1) =REF(距前高天,1)AND预判=1AND大值周期 REF(小值周期,距前低天+1)AND大值周期 REF(小值周期,距前低天)AND大值周期 REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1ANDREF(距前低天,1) REF(距前高天,1)ANDHHV(H,距前低天+1) REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1ANDREF(距前低天,1) =REF(距前高天,1)ANDREF(低保留S,距前低天)=-1AND(距前低天 =4ORHHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1OR高保留B=1OR判断=1)ANDH REF(L,距前低天+1),1,0);
预判A:=IF((距前高天 4ANDHHV(缺口判断,距前高天)!=1)ORREF(高保留,距前高天)=0,1,0);
判断A:=IF(局部低点预选C=-1ANDREF(距前高天,1) =REF(距前低天,1)AND预判A=1AND小值周期 REF(大值周期,距前高天+1)AND小值周期 REF(大值周期,距前高天)AND小值周期 REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1ANDREF(距前高天,1) REF(距前低天,1)ANDLLV(L,距前高天+1) REF(LLV(L,距前高天+1),1),-1,0);
低保留B:=IF(局部低点预选C=-1ANDREF(距前高天,1) =REF(距前低天,1)AND(距前高天 =4ORLLV(缺口判断,距前高天)=-1OR判断A=-1),-1,0);
低保留:=IF((低保留A=-1OR低保留B=-1)ANDL REF(H,距前高天+1),-1,0);
距前高天A:=BARSLAST(高保留=1);
距前低天A:=BARSLAST(低保留=-1);
预判X:=IF((距前低天A 4ANDHHV(缺口判断,距前低天A)!=1)ORREF(低保留,距前低天A)=0,1,0);
判断X:=IF(局部高点预选C=1ANDREF(距前低天A,1) =REF(距前高天A,1)AND预判X=1AND大值周期 REF(小值周期,距前低天A+1)AND大值周期 REF(小值周期,距前低天A)AND大值周期 REF(大值周期,距前高天A),1,0);
高保留XA:=IF(局部高点预选C=1ANDREF(距前低天A,1) REF(距前高天A,1)ANDHHV(H,距前低天A+1) REF(HHV(H,距前低天A+1),1),1,0);
高保留XB:=IF(局部高点预选C=1ANDREF(距前低天A,1) =REF(距前高天A,1)ANDREF(低保留,距前低天A)=-1AND(距前低天A =4ORHHV(缺口判断,距前低天A)=1),1,0);
高保留X:=IF((高保留XA=1OR高保留XB=1OR判断X=1)ANDH REF(L,距前低天A+1),1,0);
预判XA:=IF((距前高天A 4ANDHHV(缺口判断,距前高天A)!=1)ORREF(高保留XA,距前高天A)=0,1,0);
判断XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1) =REF(距前低天A,1)AND预判XA=1AND小值周期 REF(大值周期,距前高天A+1)AND小值周期 REF(大值周期,距前高天A)AND小值周期 REF(小值周期,距前低天A),-1,0);
低保留XA:=IF(局部低点预选C=-1ANDREF(距前高天A,1) REF(距前低天A,1)ANDLLV(L,距前高天A+1) REF(LLV(L,距前高天A+1),1),-1,0);
低保留XB:=IF(局部低点预选C=-1ANDREF(距前高天A,1) =REF(距前低天A,1)AND(距前高天A =4ORLLV(缺口判断,距前高天A)=-1OR判断XA=-1),-1,0);
低保留X:=IF((低保留XA=-1OR低保留XB=-1)ANDL REF(H,距前高天A+1),-1,0);
距前高天YA:=BARSLAST(高保留X=1);
距前低天YA:=BARSLAST(低保留X=-1);
预判YX:=IF((距前低天YA 4ANDHHV(缺口判断,距前低天YA)!=1)ORREF(低保留X,距前低天YA)=0,1,0);
判断YX:=IF(局部高点预选C=1ANDREF(距前低天YA,1) =REF(距前高天YA,1)AND预判YX=1AND大值周期 REF(小值周期,距前低天YA+1)AND大值周期 REF(小值周期,距前低天YA)AND大值周期 REF(大值周期,距前高天YA),1,0);
高保留YXA:=IF(局部高点预选C=1ANDREF(距前低天YA,1) REF(距前高天YA,1)ANDHHV(H,距前低天YA+1) REF(HHV(H,距前低天YA+1),1),1,0);
高保留YXB:=IF(局部高点预选C=1ANDREF(距前低天YA,1) =REF(距前高天YA,1)ANDREF(低保留X,距前低天YA)=-1AND(距前低天YA =4ORHHV(缺口判断,距前低天YA)=1),1,0);
高保留YX:=IF((高保留YXA=1OR高保留YXB=1OR判断YX=1)ANDH REF(L,距前低天YA+1),1,0);
预判YXA:=IF((距前高天YA 4ANDHHV(缺口判断,距前高天YA)!=1)ORREF(高保留YXA,距前高天YA)=0,1,0);
判断YXA:=IF(局部低点预选C=-1ANDREF(距前高天YA,1) =REF(距前低天YA,1)AND预判YXA=1AND小值周期 REF(大值周期,距前高天YA+1)AND小值周期 REF(大值周期,距前高天YA)AND小值周期 REF(小值周期,距前低天YA),-1,0);
低保留YXA:=IF(局部低点预选C=-1ANDREF(距前高天YA,1) REF(距前低天YA,1)ANDLLV(L,距前高天YA+1) REF(LLV(L,距前高天YA+1),1),-1,0);
低保留YXB:=IF(局部低点预选C=-1ANDREF(距前高天YA,1) =REF(距前低天YA,1)AND(距前高天YA =4ORLLV(缺口判断,距前高天YA)=-1OR判断YXA=-1),-1,0);
低保留YX:=IF((低保留YXA=-1OR低保留YXB=-1)ANDL REF(H,距前高天YA+1),-1,0);
AAAD:=IF(高保留YX=1AND低保留YX=-1ANDH REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1AND低保留YX=-1ANDL REF(L,REF(距前低天YA,1)+2),-1,0));
极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
{局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL))CIRCLEDOTCOLORYELLOW;}
DRAWICON(极点保留=-1,L*0.96,7);
DRAWICON(极点保留=1,H*1.04,8);
{
DRAWICON(极点保留=-1,CLOSE,7);
DRAWICON(极点保留=1,OPEN,8);
}
DRAWICON(极点保留=-1,LOW,1);
DRAWICON(极点保留=1,HIGH,2);
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,8);
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1) CANDREF(DIFF,A1+1) DIFFANDCROSS(DIFF,DEA);
DRAWTEXT(IF(B1 0,1,0),L-0.1,'MACD底背'),COLORGREEN;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
A2:=BARSLAST(REF(CROSS(K,D),1));
B2:=REF(C,A2+1) CANDREF(K,A2+1) KANDCROSS(K,D);
DRAWTEXT(IF(B2 0,1,0),L-0.25,'KDJ底背'),COLORYELLOW;
LC:=REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1) CANDREF(RSI1,A3+1) RSI1ANDCROSS(RSI1,RSI2);
DRAWTEXT(IF(B3 0,1,0),L-0.4,'RSI底背');
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1) CANDREF(DIFF,C1+1) DIFFANDCROSS(DEA,DIFF);
DRAWTEXT(IF(D1 0,1,0),H+0.1,'MACD顶背'),COLORWHITE;
C2:=BARSLAST(REF(CROSS(D,K),1));
D2:=REF(C,C2+1) CANDREF(K,C2+1) KANDCROSS(D,K);
DRAWTEXT(IF(D2 0,1,0),H+0.25,'KDJ顶背'),COLORWHITE;
C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3:=REF(C,C3+1) CANDREF(RSI1,C3+1) RSI1ANDCROSS(RSI2,RSI1);
DRAWTEXT(IF(D3 0,1,0),H+0.4,'RSI顶背');
TMP1:=IF(C MA5,1,0);
TMP2:=IF(C MA13,1,0);
TMP3:=IF(C MA21,1,0);
TMP4:=IF(C MA34,1,0);
TMP5:=IF(C MA55,1,0);
TMP6:=IF(C MA89,1,0);
TMP7:=IF(C MA144,1,0);
TMP8:=IF(C MA233,1,0);
类别:TMP1+TMP2+TMP3+TMP4+TMP5+TMP6+TMP7+TMP8+1,NODRAW;
{DRAWNUMBER(1,H,类别);};
顶:=bbi+3*stD(BBI,13),COLOR004AFF;
底:=BBI-3*STD(BBI,13),COLOR67FF00;
KU1:=IF(HIGH=HHV(HIGH,3),1,0);
kd1:=IF(LOW=LLV(LOW,3),1,0);
UL:=IF(REF(KU1,2)=1ANDREF(KU1,1)=0
ANDKU1=0,REF(HIGH,2),REF(HIGH,2+BArslAST(REF(KU1,2)=1
ANDREF(KU1,1)=0ANDKU1=0)));
DL:=IF(REF(KD1,2)=1ANDREF(KD1,1)=0
ANDKD1=0,REF(LOW,2),REF(LOW,2+BARSLAST(REF(KD1,2)=1
ANDREF(KD1,1)=0ANDKD1=0)));
HV:=H ULANDH REF(H,1);
LV:=L DLANDL REF(L,1);
GP:=BARSLAST(HV);
DP:=BARSLAST(LV);
IP:=IF(GP=0,DP,GP)
HHV1:=HVANDIPANDH =HHV(H,BARSLAST(LV));
LV1:=LVANDIPANDL =LLV(L,BARSLAST(HV));
DRAWLINE(LV1,LOW,HHV1,HIGH,0),coloryellow,LINETHICK1;
DRAWLINE(HHV1,HIGH,LV1,LOW,0),colormagenta,LINETHICK1;
V00:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
V01:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
V02:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
V03:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
V04:=REF(HIGH,2) HIGHANDREF(LOW,2) LOW
ANDREF(HIGH,2) REF(HIGH,1)ANDREF(LOW,2) REF(LOW,1);
V1:=COUNT(V00,6) =3ANDCOUNT(V01ORV02,5)=0ANDLLVBARS(LOW,6)=1ANDHHVBARS(HIGH,6) =5ANDV03;
V2:=COUNT(V00,7) =3ANDCOUNT(V01ORV02,6)=1ANDLLVBARS(LOW,7)=2ANDHHVBARS(HIGH,7) =6ANDV04;
V3:=COUNT(V00,7) =3ANDCOUNT(V01ORV02,6)=1ANDLLVBARS(LOW,7)=1ANDHHVBARS(HIGH,7) =6ANDV03;
V4:=COUNT(V00,8) =3ANDCOUNT(V01ORV02,7) =2ANDLLVBARS(LOW,8)=2ANDHHVBARS(HIGH,8) =7ANDV04;
V5:=COUNT(V00,8) =3ANDCOUNT(V01ORV02,7) =2ANDLLVBARS(LOW,8)=1ANDHHVBARS(HIGH,8) =7ANDV03;
V6:=COUNT(V00,9) =3ANDCOUNT(V01ORV02,8) =3ANDLLVBARS(LOW,9)=2ANDHHVBARS(HIGH,9) =8ANDV04;
V7:=COUNT(V00,9) =3ANDCOUNT(V01ORV02,8) =3ANDLLVBARS(LOW,9)=1ANDHHVBARS(HIGH,9) =8ANDV03;
V8:=COUNT(V00,10) =3ANDCOUNT(V01ORV02,9) =4ANDLLVBARS(LOW,10)=2ANDHHVBARS(HIGH,10) =9ANDV04;
V9:=COUNT(V00,10) =3ANDCOUNT(V01ORV02,9) =4ANDLLVBARS(LOW,10)=1ANDHHVBARS(HIGH,10) =9ANDV03;
V10:=COUNT(V00,11) =3ANDCOUNT(V01ORV02,10) =5ANDLLVBARS(LOW,11)=2ANDHHVBARS(HIGH,11) =10ANDV04;
XG:=V1ORV2ORV3ORV4ORV5ORV6ORV7ORV8ORV9ORV10;
HV00:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
HV01:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
HV02:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
HV03:=HIGH REF(HIGH,1)ANDLOW REF(LOW,1);
HV04:=REF(HIGH,2) HIGHANDREF(LOW,2) LOWANDREF(HIGH,2) REF(HIGH,1)ANDREF(LOW,2) REF(LOW,1);
HV1:=COUNT(HV00,6) =3ANDCOUNT(HV01ORHV02,5)=0ANDHHVBARS(HIGH,6)=1ANDLLVBARS(LOW,6) =5ANDHV03;
HV2:=COUNT(HV00,7) =3ANDCOUNT(HV01ORHV02,6)=1ANDHHVBARS(HIGH,7)=2ANDLLVBARS(LOW,7) =6ANDHV04;
HV3:=COUNT(HV00,7) =3ANDCOUNT(HV01ORHV02,6)=1ANDHHVBARS(HIGH,7)=1ANDLLVBARS(LOW,7) =6ANDHV03;
HV4:=COUNT(HV00,8) =3ANDCOUNT(HV01ORHV02,7) =2ANDHHVBARS(HIGH,8)=2ANDLLVBARS(LOW,8) =7ANDHV04;
HV5:=COUNT(HV00,8) =3ANDCOUNT(HV01ORHV02,7) =2ANDHHVBARS(HIGH,8)=1ANDLLVBARS(LOW,8) =7ANDHV03;
HV6:=COUNT(HV00,9) =3ANDCOUNT(HV01ORHV02,8) =3ANDHHVBARS(HIGH,9)=2ANDLLVBARS(LOW,9) =8ANDHV04;
HV7:=COUNT(HV00,9) =3ANDCOUNT(HV01ORHV02,8) =3ANDHHVBARS(HIGH,9)=1ANDLLVBARS(LOW,9) =8ANDHV03;
HV8:=COUNT(HV00,10) =3ANDCOUNT(HV01ORHV02,9) =4ANDHHVBARS(HIGH,10)=2ANDLLVBARS(LOW,10) =9ANDHV04;
HV9:=COUNT(HV00,10) =3ANDCOUNT(HV01ORHV02,9) =4ANDHHVBARS(HIGH,10)=1ANDLLVBARS(LOW,10) =9ANDHV03;
HV10:=COUNT(HV00,11) =3ANDCOUNT(HV01ORHV02,10) =5ANDHHVBARS(HIGH,11)=2ANDLLVBARS(LOW,11) =10ANDHV04;
HXG:=HV1ORHV2ORHV3ORHV4ORHV5ORHV6ORHV7ORHV8ORHV9ORHV10;
缠论指标公式大全截图