通达信常用的DIY主图指标源码 各取所需 希望对你有用
-
相关简介:通达信常用的DIY主图指标源码 各取所需 希望对你有用
-
文章来源:股海网作者:股海网发布时间:2022-09-15浏览次数:
通达信常用的DIY主图指标源码 各取所需 希望对你有用
{均线}
MA5:MA(C,5),COLORWHITE;
MA10:MA(C,10),COLORYELLOW;
MA30:MA(C,30),COLORMAGENTA;
MA60:MA(C,60),COLORRED;
MA120:MA(C,120),COLORBLUE;
MA250:MA(C,250),COLORGREEN;
{变色BBI}
BBI:(MA(CLOSE,3)+MA(CLOSE,6)+MA(CLOSE,12)+MA(CLOSE,24))/4;
IF(C>=BBI,BBI,DRAWNULL),COLORRED;
IF(C<BBI,BBI,DRAWNULL),COLORGREEN;
{神奇九转}
B:=C<REF(C,4);
N:=CURRBARSCOUNT;
B1:=(N=6 AND REFXV(COUNT(B,6),5)=6) OR (N=7 AND REFXV(COUNT(B,7),6)=7) OR (N=8 AND REFXV(COUNT(B,8),7)=8) OR (N>=9 AND REFXV(COUNT(B,9),8)=9);
DRAWNUMBER(B1 AND REF(B,1)=0,L,1),COLORMAGENTA;
B2:=(N=5 AND REFXV(COUNT(B,6),4)=6) OR (N=6 AND REFXV(COUNT(B,7),5)=7) OR (N=7 AND REFXV(COUNT(B,8),6)=8) OR (N>=8 AND REFXV(COUNT(B,9),7)=9);
DRAWNUMBER(B2 AND REF(B,2)=0,L,2),COLORMAGENTA;
B8:=(N=1 AND COUNT(B,8)=8) OR (N>=2 AND REFXV(COUNT(B,9),1)=9);
DRAWNUMBER(B8 AND REF(B,8)=0,L,8),COLORMAGENTA;
B9:=(N>=1 AND COUNT(B,9)=9);
DRAWNUMBER(B9 AND REF(B,9)=0,L,9),COLORBROWN;
S:=C>REF(C,4);
S1:=(N=6 AND REFXV(COUNT(S,6),5)=6) OR (N=7 AND REFXV(COUNT(S,7),6)=7) OR (N=8 AND REFXV(COUNT(S,8),7)=8) OR (N>=9 AND REFXV(COUNT(S,9),8)=9);
DRAWNUMBER(S1 AND REF(S,1)=0,H,1),COLORMAGENTA,DRAWABOVE;
S2:=(N=5 AND REFXV(COUNT(S,6),4)=6) OR (N=6 AND REFXV(COUNT(S,7),5)=7) OR (N=7 AND REFXV(COUNT(S,8),6)=8) OR (N>=8 AND REFXV(COUNT(S,9),7)=9);
DRAWNUMBER(S2 AND REF(S,2)=0,H,2),COLORMAGENTA,DRAWABOVE;
S8:=(N=1 AND COUNT(S,8)=8) OR (N>=2 AND REFXV(COUNT(S,9),1)=9);
DRAWNUMBER(S8 AND REF(S,8)=0,H,8),COLORMAGENTA,DRAWABOVE;
S9:=(N>=1 AND COUNT(S,9)=9);
DRAWNUMBER(S9 AND REF(S,9)=0,H,9),COLORGREEN,DRAWABOVE;
{虚拟涨跌停}
KXZT:=IF(CURRBARSCOUNT=1 AND PERIOD=5 AND NOT(C>1500 OR DYNAINFO(7)=0) AND C>=O,REF(CLOSE,1)*1.1,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1 AND PERIOD=5,KXZT,MAX(OPEN,CLOSE),-1,-1),COLOR00C0C0;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
KXDT:=IF(CURRBARSCOUNT=1 AND PERIOD=5 AND NOT(C>1500) AND C<O,REF(CLOSE,1)*0.9,DRAWNULL),NODRAW;
STICKLINE(CURRBARSCOUNT=1 AND PERIOD=5,KXDT,MIN(OPEN,CLOSE),-1,-1),COLORLIBLUE;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
STICKLINE(CURRBARSCOUNT=1&&(CODELIKE('68')>0||CODELIKE('30')>0)&&PERIOD=5&&C>O,ZTPRICE(REF(C,1),0.2),MAX(OPEN,CLOSE),-1,-1),COLORMAGENTA;
STICKLINE(CURRBARSCOUNT=1&&(CODELIKE('68')>0||CODELIKE('30')>0)&&PERIOD=5&&C<O,DTPRICE(REF(C,1),0.2),MIN(OPEN,CLOSE),-1,-1),COLORGRAY;
{涨跌停K线变色}
RQ:=IF(DATE>=1200824,1,0);
KCB:=IF(INBLOCK('科创板'),1,0);
CYB:=IF(INBLOCK('创业板') AND RQ,1,0);
{20%涨停洋红色,跌停蓝色}
STICKLINE(C/REF(C,1)>1.195 AND C=H AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORMAGENTA;
STICKLINE(C/REF(C,1)<0.805 AND C=L AND (KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORBLUE;
{10%涨停红色,跌停绿色}
STICKLINE(C/REF(C,1)>1.095 AND C=H AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORRED;
STICKLINE(C/REF(C,1)<0.905 AND C=L AND NOT(KCB OR CYB) AND PERIOD=5,O,C,3,0),COLORGREEN;
{涨跌停价格}
TM:=1200823;
涨停:IF(DATE<TM,ZTPRICE(REF(C,1),IF(CODELIKE('688'),0.2,IF(NAMEINCLUDE('S'),0.05,0.1))),ZTPRICE(REF(C,1),IF(CODELIKE('688') OR CODELIKE('300'),0.2,IF(NAMEINCLUDE('S'),0.05,0.1)))),NODRAW,COLORRED;
跌停:IF(DATE<TM,DTPRICE(REF(C,1),IF(CODELIKE('688'),0.2,IF(NAMEINCLUDE('S'),0.05,0.1))),DTPRICE(REF(C,1),IF(CODELIKE('688') OR CODELIKE('300'),0.2,IF(NAMEINCLUDE('S'),0.05,0.1)))),NODRAW,COLORGREEN;
明涨停:IF(DATE<TM,C*IF(CODELIKE('688'),1.2,IF(NAMEINCLUDE('S'),1.05,1.1)),C*(IF(CODELIKE('688') OR CODELIKE('300'),1.2,IF(NAMEINCLUDE('S'),1.05,1.1)))),NODRAW,COLORLIMAGENTA;
明跌停:IF(DATE<TM,C*IF(CODELIKE('688'),0.8,IF(NAMEINCLUDE('S'),0.45,0.9)),C*(IF(CODELIKE('688') OR CODELIKE('300'),0.8,IF(NAMEINCLUDE('S'),0.45,0.9)))),NODRAW,COLORFFFF00;
{近日最高最低价画线}
近日高:IF(CURRBARSCOUNT<=CONST(FINDHIGHBARS(HIGH,0,6,1)+1),CONST(FINDHIGH(HIGH,0,6,1)),DRAWNULL),COLORRED,LINETHICK1;
近日低:IF(CURRBARSCOUNT<=CONST(FINDLOWBARS(LOW,0,6,1)+1),CONST(FINDLOW(LOW,0,6,1)),DRAWNULL),COLORGREEN,LINETHICK1;
DRAWSL(ISLASTBAR,近日高,0,2000,1),COLORRED,LINETHICK1;
DRAWSL(ISLASTBAR,近日低,0,2000,1),COLORGREEN,LINETHICK1;
{大于5%分时均价}
分时均价:AMOUNT/VOL/100,NODRAW,COLORYELLOW;
大阳:=C>=REF(C,1)*1.05 AND C>O;
大阴:=C<=REF(C,1)*0.95 AND C<O;
STICKLINE(分时均价 AND 大阳,分时均价,分时均价,2.9,0),COLORWHITE;
STICKLINE(分时均价 AND 大阴,分时均价,分时均价,2.9,0),COLORRED;
{安全分}
DRAWTEXT_FIX(1,0.35,1,1,STRCAT(STRCAT('安全分:',CON2STR(SAFESCORE,0)),'分'))COLORFF00FF;
{指定日期标记}
DRAWICON(DATE=1220901,LOW,41);
{月份标记}
JZX:=MONTH<>REF(MONTH,1);{时间取值取月}
DRAWNUMBER(JZX,L,MONTH)COLORMAGENTA;
{周标记}
JZX:=WEEKDAY<>REF(WEEKDAY,1);{时间取值取周}
DRAWNUMBER(JZX,L,WEEKDAY)COLORYELLOW;