通达信画线主图源码 说明
画线主图【源码 附件 贴图 说明】
画线本身含未来,参数也是个头痛的问题,所以最小参数周期取3,减少未来天数,只做看盘趋势用(蓝色方框),实盘中决策止损止赢靠大脑,任何公式都没有百分百的成功率...
(附件为初学者,即不会填写参数的人准备,和源码一样)
{参数N 1 300 3
M 5
N1 10
N2 20
N3 34}
JJH:=H;
JJL:=L;
AA2:=REF(JJH,N)=HHV(JJH,2*N+1);
AA3:=FILTER(AA2,N);
AA4:=BACKSET(AA3,N+1);
AA5:=FILTER(AA4,N);
AA7:=REF(JJL,N)=LLV(JJL,2*N+1);
AA8:=FILTER(AA7,N);
AA9:=BACKSET(AA8,N+1);
AA10:=FILTER(AA9,N);
AA11:=REF(H,BARSLAST(AA5));
AA12:=REF(L,BARSLAST(AA10));
AA13:=BARSLAST(AA5)<BARSLAST(AA10) AND NOT(AA5) ;
AA14:=BARSLAST(AA5)>BARSLAST(AA10) AND NOT(AA10);
AA15:=BARSLAST(AA5);
AA16:=CONST(AA15);
AA17:=REF(AA11,AA15+1);
AA18:=CONST(AA17);
AA19:=BARSLAST(H=AA18);
AA20:=CONST(AA19);
AA21:=BARSLAST(AA10);
AA22:=CONST(AA21);
AA23:=REF(AA12,AA21+1);
AA24:=CONST(AA23);
AA25:=BARSLAST(L=AA24);
AA26:=CONST(AA25);
RR:=BARSLAST(H=CONST(AA11));
BB2:=REF(JJH,M)=HHV(JJH,2*M+1);
BB3:=FILTER(BB2,M);
BB4:=BACKSET(BB3,M+1);
BB5:=FILTER(BB4,M);
BB7:=REF(JJL,M)=LLV(JJL,2*M+1);
BB8:=FILTER(BB7,M);
BB9:=BACKSET(BB8,M+1);
BB10:=FILTER(BB9,M);
BB11:=REF(H,BARSLAST(BB5));
BB12:=REF(L,BARSLAST(BB10));
BB13:=BARSLAST(BB5)<BARSLAST(BB10) AND NOT(BB5) ;
BB14:=BARSLAST(BB5)>BARSLAST(BB10) AND NOT(BB10);
BB15:=BARSLAST(BB5);
BB16:=CONST(BB15);
BB17:=REF(BB11,BB15+1);
BB18:=CONST(BB17);
BB19:=BARSLAST(H=BB18);
BB20:=CONST(BB19);
BB21:=BARSLAST(BB10);
BB22:=CONST(BB21);
BB23:=REF(BB12,BB21+1);
BB24:=CONST(BB23);
BB25:=BARSLAST(L=BB24);
BB26:=CONST(BB25);
PP:=MIN(AA26,BB15);
QQ:=FILTER(V>0,CURRBARSCOUNT-CONST(PP)-1);
STICKLINE(QQ,CONST(BB11),CONST(AA23),8,0),COLOR646400;
CC2:=REF(JJH,N1)=HHV(JJH,2*N1+1);
CC3:=FILTER(CC2,N1);
CC4:=BACKSET(CC3,N1+1);
CC5:=FILTER(CC4,N1);
CC7:=REF(JJL,N1)=LLV(JJL,2*N1+1);
CC8:=FILTER(CC7,N1);
CC9:=BACKSET(CC8,N1+1);
CC10:=FILTER(CC9,N1);
CC11:=REF(H,BARSLAST(CC5));
CC12:=REF(L,BARSLAST(CC10));
CC13:=BARSLAST(CC5)<BARSLAST(CC10) AND NOT(CC5) ;
CC14:=BARSLAST(CC5)>BARSLAST(CC10) AND NOT(CC10);
CC15:=BARSLAST(CC5);
CC16:=CONST(CC15);
CC17:=REF(CC11,CC15+1);
CC18:=CONST(CC17);
CC19:=BARSLAST(H=CC18);
CC20:=CONST(CC19);
CC21:=BARSLAST(CC10);
CC22:=CONST(CC21);
CC23:=REF(CC12,CC21+1);
CC24:=CONST(CC23);
CC25:=BARSLAST(L=CC24);
CC26:=CONST(CC25);
DD2:=REF(JJH,N2)=HHV(JJH,2*N2+1);
DD3:=FILTER(DD2,N2);
DD4:=BACKSET(DD3,N2+1);
DD5:=FILTER(DD4,N2);
DD7:=REF(JJL,N2)=LLV(JJL,2*N2+1);
DD8:=FILTER(DD7,N2);
DD9:=BACKSET(DD8,N2+1);
DD10:=FILTER(DD9,N2);
DD11:=REF(H,BARSLAST(DD5));
DD12:=REF(L,BARSLAST(DD10));
DD13:=BARSLAST(DD5)<BARSLAST(DD10) AND NOT(DD5) ;
DD14:=BARSLAST(DD5)>BARSLAST(DD10) AND NOT(DD10);
DD15:=BARSLAST(DD5);
DD16:=CONST(DD15);
DD17:=REF(DD11,DD15+1);
DD18:=CONST(DD17);
DD19:=BARSLAST(H=DD18);
DD20:=CONST(DD19);
DD21:=BARSLAST(DD10);
DD22:=CONST(DD21);
DD23:=REF(DD12,DD21+1);
DD24:=CONST(DD23);
DD25:=BARSLAST(L=DD24);
DD26:=CONST(DD25);
EE2:=REF(JJH,N3)=HHV(JJH,2*N3+1);
EE3:=FILTER(EE2,N3);
EE4:=BACKSET(EE3,N3+1);
EE5:=FILTER(EE4,N3);
EE7:=REF(JJL,N3)=LLV(JJL,2*N3+1);
EE8:=FILTER(EE7,N3);
EE9:=BACKSET(EE8,N3+1);
EE10:=FILTER(EE9,N3);
EE11:=REF(H,BARSLAST(EE5));
EE12:=REF(L,BARSLAST(EE10));
EE13:=BARSLAST(EE5)<BARSLAST(EE10) AND NOT(EE5) ;
EE14:=BARSLAST(EE5)>BARSLAST(EE10) AND NOT(EE10);
EE15:=BARSLAST(EE5);
EE16:=CONST(EE15);
EE17:=REF(EE11,EE15+1);
EE18:=CONST(EE17);
EE19:=BARSLAST(H=EE18);
EE20:=CONST(EE19);
EE21:=BARSLAST(EE10);
EE22:=CONST(EE21);
EE23:=REF(EE12,EE21+1);
EE24:=CONST(EE23);
EE25:=BARSLAST(L=EE24);
EE26:=CONST(EE25);
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
压力:DRAWLINE(CURRBARSCOUNT=CONST(RR)+1,AA11,CURRBARSCOUNT=1,AA11,1),COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=AA20+1,H,IF(CONST(AA11)>=CONST(AA17),CURRBARSCOUNT=AA20+1,CURRBARSCOUNT=AA16+1),H,1),COLORLIRED;
DRAWLINE(CURRBARSCOUNT=AA26+1,L,CURRBARSCOUNT=AA22+1,L,1),COLORRED;
DRAWLINE(CURRBARSCOUNT=BB20+1,H,IF(CONST(BB11)>=CONST(BB17),CURRBARSCOUNT=BB20+1,CURRBARSCOUNT=BB16+1),H,1),COLORBBFFFF;
DRAWLINE(CURRBARSCOUNT=BB26+1,L,CURRBARSCOUNT=BB22+1,L,1),COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=CC20+1,H,IF(CONST(CC11)>=CONST(CC17),CURRBARSCOUNT=CC20+1,CURRBARSCOUNT=CC16+1),H,1),COLORFF00BB;
DRAWLINE(CURRBARSCOUNT=CC26+1,L,CURRBARSCOUNT=CC22+1,L,1),COLORMAGENTA;
DRAWLINE(CURRBARSCOUNT=DD20+1,H,IF(CONST(DD11)>=CONST(DD17),CURRBARSCOUNT=DD20+1,CURRBARSCOUNT=DD16+1),H,1),COLORC5AC72;
DRAWLINE(CURRBARSCOUNT=DD26+1,L,CURRBARSCOUNT=DD22+1,L,1),COLOREEAC72;
DRAWLINE(CURRBARSCOUNT=EE20+1,H,IF(CONST(EE11)>=CONST(EE17),CURRBARSCOUNT=EE20+1,CURRBARSCOUNT=EE16+1),H,1),COLORABD0BC;
DRAWLINE(CURRBARSCOUNT=EE26+1,L,CURRBARSCOUNT=EE22+1,L,1),COLORABD066;
{涨跌停K线}
{涨跌停次数K线}
涨停:=(C-REF(C,1))*100/REF(C,1)>9.7;
跌停:=(C-REF(C,1))*100/REF(C,1)<-9.5;
TESTSKIP(PERIOD>5);
STICKLINE((C-REF(C,1))*100/REF(C,1)>9.7,O,C,2,0),COLORRED;
STICKLINE((C-REF(C,1))*100/REF(C,1)<-9.5,O,C,2,0),COLORGREEN;
NUMBER:=COUNT(涨停,BARSSINCE(涨停)+1),COLORYELLOW;
DRAWNUMBER(涨停,H*1.04,NUMBER),COLORWHITE;
NUMBER1:=COUNT(跌停,BARSSINCE(跌停)+1),COLORYELLOW;
DRAWNUMBER(跌停,H*1.04,NUMBER1),COLORGREEN;