通达信量学主图指标公式

[复制链接]
查看152 | 回复0 | 2021-8-20 20:56:00 | 显示全部楼层 |阅读模式

周期以内:=100;
大阴跌幅:=3;
允许穿越:=0;
大阴周期:=1;
虚线宽度:=3;
N日最高:=60;
N日最低:=60;
N:=20;
M:=32;
P1:=80;
P2:=100;
实体上三分之一:(MAX(O,C)-MIN(O,C))*2/3+MIN(O,C),COLORGREEN,NODRAW;
实体下三分之一:(MAX(O,C)-MIN(O,C))/3+MIN(O,C),NODRAW;
实体二分之一:(O+C)/2,NODRAW;
整体上三分之一:(MAX(H,L)-MIN(H,L))*2/3+MIN(H,L),NODRAW;
整体下三分之一:(MAX(H,L)-MIN(H,L))/3+MIN(H,L),COLORYELLOW,NODRAW;
整体二分之一:(H+L)/2,COLORLIMAGENTA,NODRAW;
STICKLINE(O<>C,实体上三分之一,实体下三分之一,2,0),COLOR824173;
STICKLINE(O<>C,实体二分之一,实体二分之一,2,0),COLORGREEN;
最高:=HHV(MAX(O,C),N日最高);
最低:=LLV(MIN(O,C),N日最低);
上涨:BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=最低)+1)),COLOR0000FF,NODRAW;
↑空间%:(C/REF(L,上涨)-1)*100,COLOR00FFFF,NODRAW;
最高%:(最高/REF(L,上涨)-1)*100,COLORFF00FF,NODRAW;
下跌:BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=最高)+1)),COLOR00FF00,NODRAW;
↓空间%:(C/REF(H,下跌)-1)*100,COLOR888899,NODRAW;
最低%:(最低/REF(H,下跌)-1)*100,COLORFF0000,NODRAW;
天线:REFDATE(REF(H,下跌),DATE),POINTDOT,LINETHICK3,COLORYELLOW;
地线:REFDATE(REF(L,上涨),DATE),POINTDOT,LINETHICK3,COLORYELLOW;
中线:REFDATE((天线-地线)*0.5+地线,DATE),POINTDOT,LINETHICK3,COLORYELLOW;
STICKLINE(上涨=0,天线,地线,0,-1),COLORYELLOW;
STICKLINE(下跌=0,天线,地线,0,-1),COLORYELLOW;
DRAWTEXT(ISLASTBAR,天线,VAR2STR(天线,2)),COLORYELLOW;
DRAWTEXT(ISLASTBAR,中线,VAR2STR(中线,2)),COLORYELLOW;
DRAWTEXT(ISLASTBAR,地线,VAR2STR(地线,2)),COLORYELLOW;
{2}
高:=天线;
低:=地线;
H2:=高-(高-低)*0.333;
H3:=高-(高-低)*0.5;
H4:=高-(高-低)*0.666;
DRAWTEXT(上涨=0,天线,'-最高'),COLOR0000FF;
DRAWTEXT(上涨=0,低,'-最低'),COLORRED;
DRAWTEXT(下跌=0,高,'-高'),COLORGREEN;
DRAWTEXT(下跌=0,地线,'-低'),COLOR00FF00;
DRAWTEXT(下跌=0,H2,'-0.666'),COLORGRAY;
DRAWTEXT(下跌=0,H3,'-中'),COLORYELLOW;
DRAWTEXT(下跌=0,H4,'-0.333'),COLORLIRED;
DRAWTEXT(上涨=0,H2,'-上三一位'),COLORGRAY;
DRAWTEXT(上涨=0,H3,'-中'),COLORYELLOW;
DRAWTEXT(上涨=0,H4,'-下三一位'),COLORLIRED;
周期:CURRBARSCOUNT,NODRAW,COLORGREEN;
X_1:=REFX(HHV(MAX(OPEN,CLOSE),周期以内),周期-1);
X_2:=REFX(LLV(LOW,周期以内),周期-1);
X_3:=CLOSE/REF(CLOSE,1)<=1-大阴跌幅/100 AND OPEN>CLOSE AND DATE<=1181101;
X_4:=IF(周期以内=1,0.5,IF(周期以内=2,1,IF(周期以内=3,(-1),IF(周期以内=4,3,4))));
X_5:=0;
X_6:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1)),周期-1);
X_7:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_6)),周期-1);
X_8:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_7)),周期-1);
X_9:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_8)),周期-1);
X_10:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_9)),周期-1);
X_11:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_10)),周期-1);
X_12:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_11)),周期-1);
X_13:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_12)),周期-1);
X_14:=REFX(REF(OPEN,BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_13)),周期-1);
X_15:=REFX(BARSLAST(X_3 AND OPEN<X_1),周期-1)+1;
X_16:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_6),周期-1)+1;
X_17:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_7),周期-1)+1;
X_18:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_8),周期-1)+1;
X_19:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_9),周期-1)+1;
X_20:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_10),周期-1)+1;
X_21:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_11),周期-1)+1;
X_22:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_12),周期-1)+1;
X_23:=REFX(BARSLAST(X_3 AND OPEN<X_1 AND OPEN>X_13),周期-1)+1;
X_24:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_6,X_15-周期)=0);
X_25:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_7,X_16-周期)=0);
X_26:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_8,X_17-周期)=0);
X_27:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_9,X_18-周期)=0);
X_28:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_10,X_19-周期)=0);
X_29:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_11,X_20-周期)=0);
X_30:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_12,X_21-周期)=0);
X_31:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_13,X_22-周期)=0);
X_32:=IF(允许穿越=1,1,COUNT(MAX(OPEN,CLOSE)>X_14,X_23-周期)=0);
STICKLINE(周期<X_15 AND X_24,X_6,X_6,1,X_5),COLORLIGREEN;
STICKLINE(周期<X_16 AND X_25,X_7,X_7,1,X_5),COLORLIBLUE;
STICKLINE(周期<X_17 AND X_26,X_8,X_8,1,X_5),COLORLIGREEN;
STICKLINE(周期<X_18 AND X_27,X_9,X_9,1,X_5),COLORLIBLUE;
STICKLINE(周期<X_19 AND X_28,X_10,X_10,1,X_5),COLORLIGREEN;
STICKLINE(周期<X_20 AND X_29,X_11,X_11,1,X_5),COLORLIBLUE;
STICKLINE(周期<X_21 AND X_30,X_12,X_12,1,X_5),COLORLIGREEN;
STICKLINE(周期<X_22 AND X_31,X_13,X_13,1,X_5),COLORLIBLUE;
STICKLINE(周期<X_23 AND X_32,X_14,X_14,1,X_5),COLORLIGREEN;
DRAWTEXT(ISLASTBAR,X_6,VAR2STR(X_6,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_7,VAR2STR(X_7,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_8,VAR2STR(X_8,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_9,VAR2STR(X_9,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_10,VAR2STR(X_10,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_11,VAR2STR(X_11,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_12,VAR2STR(X_12,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_13,VAR2STR(X_13,2)),COLORLIRED;
DRAWTEXT(ISLASTBAR,X_14,VAR2STR(X_14,2)),COLORLIRED;
MA13:MA(CLOSE,13),DOTLINE,COLORWHITE;
止损线: EMA(COST(81),10) COLORYELLOW,DOTLINE;
当前获利筹码:IF(WINNER(CLOSE),WINNER(CLOSE)*100,0),NODRAW;
ZT:=C>REF(C,1)*1.090 AND C<REF(C,1)*1.105;
DT:=C<REF(C,1)*0.901 AND C>REF(C,1)*0.898;
STICKLINE(ZT,C,O,4,0),COLORYELLOW;
STICKLINE(DT,C,O,2,0),COLORBLUE;
{DRAWTEXT(ZT,L-0.1,'涨停'),COLORRED;
DRAWTEXT(DT,H+0.3,'跌停'),COLORGREEN;}
DIF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);
DEA:=EMA(DIF,9);
AAA0:=(DIF-DEA)*2*60;
起爆:=CROSS(AAA0-REF(AAA0,1),15),COLORRED,LINETHICK2;
DRAWTEXT(起爆,L*0.99,'↖暴张'),COLORYELLOW,LINETHICK2;
STICKLINE(起爆,OPEN,CLOSE,0.5,0),COLORRED;
{现价画直线}
现价:DRAWLINE(CURRBARSCOUNT=TOTALBARSCOUNT,CONST(C),CURRBARSCOUNT=1,C,3),DOTLINE,COLORLIGRAY;
DRAWTEXT_FIX(1,0,0.1,0,'【所属行业】:'),COLORYELLOW;
Z1:=STRCAT(HYBLOCK,' ');
Z2:=STRCAT(Z1,DYBLOCK);
Z3:=STRCAT(Z2,' ');
DRAWTEXT_FIX(1,0.07,0.1,0,STRCAT(Z3,GNBLOCK)),COLORYELLOW;
DIR2:=ABS(CLOSE-REF(CLOSE,30));
VIR2:=SUM(ABS(CLOSE-REF(CLOSE,1)),30);
ER2:=DIR2/VIR2;
CS2:=ER2*(0.8-2/24)+2/24;
CQ2:=CS2*CS2;
M熊:EMA(DMA(CLOSE,CQ2),2),COLORGREEN,LINETHICK1;
牛熊:=M熊;
M震:IF(M熊/REF(M熊,1)>0.997,M熊,DRAWNULL),COLORCYAN,LINETHICK1;
M牛:IF(M熊/REF(M熊,1)>1.001,M熊,DRAWNULL),COLORLIRED,LINETHICK1;
HH:=(20*H+19*REF(H,1)+18*REF(H,2)+17*REF(H,3)+16*REF(H,4)+15*REF(H,5)+14*REF(H,6)
+13*REF(H,7)+12*REF(H,8)+11*REF(H,9)+10*REF(H,10)+9*REF(H,11)+8*REF(H,12)
+7*REF(H,13)+6*REF(H,14)+5*REF(H,15)+4*REF(H,16)+3*REF(H,17)+2*REF(H,18)+
REF(H,20))/210,COLORBLUE,LINETHICK1;
LL:=(20*L+19*REF(L,1)+18*REF(L,2)+17*REF(L,3)+16*REF(L,4)+15*REF(L,5)+14*REF(L,6)
+13*REF(L,7)+12*REF(L,8)+11*REF(L,9)+10*REF(L,10)+9*REF(L,11)+8*REF(L,12)
+7*REF(L,13)+6*REF(L,14)+5*REF(L,15)+4*REF(L,16)+3*REF(L,17)+2*REF(L,18)+
REF(L,20))/210,COLORBLUE,LINETHICK1;
D90H:=EMA(HH,90),COLORRED,LINETHICK1;
D90L:=EMA(LL,90),COLORRED,LINETHICK1;
G0:=(XMA(XMA(H,25),25)-XMA(XMA(L,25),25))+XMA(XMA(H,25),25);
D0:=XMA(XMA(L,25),25)-(XMA(XMA(H,25),25)-XMA(XMA(L,25),25));
{GO0:=(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*3+XMA(XMA(H,60),60);
DO0:=XMA(XMA(L,60),60)-(XMA(XMA(H,60),60)-XMA(XMA(L,60),60))*3;}
{STICKLINE(CURRBARSCOUNT=1,G0,G0,100,5),COLORYELLOW;
STICKLINE(CURRBARSCOUNT=1,D0,D0,100,5),COLORYELLOW;
STICKLINE(CURRBARSCOUNT=1,GO0,GO0,100,5),COLORMAGENTA;
STICKLINE(CURRBARSCOUNT=1,DO0,DO0,100,5),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,G0,'卖'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,D0,'买'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,GO0,'顶'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,DO0,'底'),COLORMAGENTA;}
DTD:=(D0+G0)/2>=(D90H+D90L)/2;
YM:=EMA(SLOPE((CLOSE+HIGH+LOW)/3,24)*20+(CLOSE+HIGH+LOW)/3,48),COLORRED,LINETHICK1;
YM1:=EMA(YM,5),COLORGREEN,LINETHICK1;
STICKLINE(L<D0 AND DTD=1 AND YM>YM1,L,D0,1.5,0),COLORWHITE;
VAR01:=(C+H+O+L)/4;
卖出:=XMA(VAR01,N)*(1+P1/1000),COLORGREEN,POINTDOT,LINETHICK3;
买入:=XMA(VAR01,M)*(1-P2/1000),COLORMAGENTA,POINTDOT,LINETHICK3;
{DRAWBAND(卖出,RGB(0,80,60),买入,RGB(0,0,0));}
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
幅度:100*(卖出-买入)/买入,NODRAW,COLORFF00FF;
MA1:=MA(VAR01,3);
STICKLINE(卖出>LOW AND 卖出<HIGH,卖出,MAX(卖出,MAX(OPEN,CLOSE)),2,0),COLORGREEN;
STICKLINE(卖出>MIN(C,O) AND 卖出<MAX(C,O),卖出,MAX(OPEN,CLOSE),2,0),COLORGREEN;
STICKLINE(卖出>LOW AND 卖出<HIGH,卖出,HIGH,0,0),COLORGREEN;
STICKLINE(卖出<LOW,OPEN,CLOSE,2,0),COLORGREEN;
STICKLINE(卖出<LOW,HIGH,LOW,0,0),COLORGREEN;
STICKLINE(买入>LOW AND 买入<HIGH,买入,MIN(MIN(OPEN,CLOSE),买入),2,0),COLORMAGENTA;
STICKLINE(买入>MIN(C,O) AND 买入<MAX(C,O),买入,MIN(OPEN,CLOSE),2,0),COLORMAGENTA;
STICKLINE(买入>LOW AND 买入<HIGH,买入,LOW,0,0),COLORMAGENTA;
STICKLINE(买入>HIGH,OPEN,CLOSE,2,0),COLORMAGENTA;
STICKLINE(买入>HIGH,HIGH,LOW,0,0),COLORMAGENTA;
{DRAWTEXT(CROSS(C,买入) OR (L<买入),LOW*0.95,'B'),COLORRED,LINETHICK2;
DRAWTEXT(CROSS(C,卖出) OR (H>卖出),HIGH*1.02,'S'),COLORGREEN;};

202108201356.jpg

202108201356.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则