通达信波段+资金主图指标 源码公式

[复制链接]
查看436 | 回复0 | 2021-8-28 00:43:07 | 显示全部楼层 |阅读模式

以下是通达信波段+资金主图指标 源码公式(无源码的请下载附件导入)

资金主图,可以看 涨跌动因 主力活跃度 主力资金线 大单动向 主力净买
 

N:=20;

买线:=EMA(C,2);
卖线:=EMA(SLOPE(C,21)*20+C,42);
STICKLINE(买线>=卖线,REFDATE(HHV(H,130),DATE),REFDATE(LLV(L,130),DATE),5,0),COLOR000055;
STICKLINE(买线<卖线,REFDATE(HHV(H,130),DATE),REFDATE(LLV(L,130),DATE),5,0),COLOR663300;
DRAWKLINE(H,O,L,C); 
ZKP:=IF(C>REF(C,1),REF(C,1),DRAWNULL);
ZSP:=IF(C>REF(C,1),C,DRAWNULL);
DKP:=IF(C<=REF(C,1),REF(C,1),DRAWNULL);
DSP:=IF(C<=REF(C,1),C,DRAWNULL);
TY:=C;
A1:=REF(TY,10)=HHV(TY,2*10+1);
B1:=FILTER(A1,10);
C1:=BACKSET(B1,10+1);
HD:=FILTER(C1,10);
A2:=REF(TY,10)=LLV(TY,2*10+1);
B2:=FILTER(A2,10);
C2:=BACKSET(B2,10+1);
LD:=FILTER(C2,10);
DRAWRECTREL(0,730,534,999.4,IF(120,RGB(10,0,0),0));
超B:=L2_AMO(0,2)/10000.0;
大B:=L2_AMO(1,2)/10000.0;
中B:=L2_AMO(2,2)/10000.0;
小B:=L2_AMO(3,2)/10000.0;
超S:=-L2_AMO(0,3)/10000.0;
大S:=-L2_AMO(1,3)/10000.0;
中S:=-L2_AMO(2,3)/10000.0;
小S:=-L2_AMO(3,3)/10000.0;
净流入:=(超B+大B+中B+小B)+(超S+大S+中S+小S);
中单:=中B+中S;
大宗净流入:=(超B+大B)+(超S+大S);
三日大宗:=SUM(大宗净流入,3);
十日大宗:=SUM(大宗净流入,10);
超大单:=(超B)+(超S);
大单:=(大B)+(大S);
小单:=(小B)+(小S);
大宗进:=(超B)+(大B);
大宗出:=(超S)+(大S);
非大宗进:=(中B)+(小B);
非大宗出:=(中S)+(小S);
近3日流向:=SUM(净流入,3);
近10日流向:=SUM(净流入,10);
主力买力度:=LARGEINTRDVOL*100/VOL;
主力卖力度:=LARGEOUTTRDVOL*100/VOL;
AAB:=CONST(MAX(ABS(超大单),MAX(ABS(大单),MAX(ABS(中单),ABS(小单)))))*1.5,NODRAW;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.009,0.9,0,INTPART(超大单)),COLOR0000FF;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.080,0.9,0,INTPART(大单)),COLORWHITE;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.149,0.9,0,INTPART(中单)),COLOR40FF00;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.218,0.9,0,INTPART(小单)),COLORWHITE;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.009,1,0,'超大单'),COLOR0000FF;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.078,1,0,'大单'),COLOR0080FF;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.147,1,0,'中单'),COLOR000080;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.216,1,0,'小单'),COLOR00FF00;
AAC:=CONST(MAX(ABS(净流入),MAX(ABS(近3日流向),ABS(近10日流向))))*1.5,NODRAW;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.304,0.9,0,INTPART(净流入)),COLOR0000FF;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.386,0.9,0,INTPART(近3日流向)),COLORWHITE;
DRAWNUMBER_FIX(CURRBARSCOUNT=1,0.461,0.9,0,INTPART(近10日流向)),COLORFFFF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.300,1,0,'净 流 入'),COLORYELLOW;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.382,1,0,'三日流向'),COLORFF00FF;
DRAWTEXT_FIX(CURRBARSCOUNT=1,0.458,1,0,'十日流向'),COLORYELLOW;
DDZ:=IF(TRADENUM>0,(LARGETRDINNUM-LARGETRDOUTNUM)/TRADENUM*100,0);
DDY:=IF(TRADENUM>0,(TRADEOUTNUM-TRADEINNUM)*100/TRADENUM,0);
DDX:=(LARGEINTRDVOL-LARGEOUTTRDVOL)*100/CAPITAL;
DRAWRECTREL(2,745,160,800,IF(CONST(DDZ)>0,RGB(192,17,27),RGB(0,50,0)));
DRAWRECTREL(175,745,343,800,IF(CONST(DDY)>0,RGB(192,17,27),RGB(0,50,0)));
DRAWRECTREL(358,745,520,800,IF(CONST(DDX)>0,RGB(192,17,27),RGB(0,50,0)));
DRAWTEXT_FIX(1,0.005,0.745,0,STRCAT('大单差分:',CON2STR(DDZ,2))),COLORWHITE;
DRAWTEXT_FIX(1,0.184,0.745,0,STRCAT('涨跌动因:',CON2STR(DDY,2))),COLORWHITE;
DRAWTEXT_FIX(1,0.363,0.745,0,STRCAT('大单动向:',CON2STR(DDX,2))),COLORWHITE;
T1Z:=IF (DDZ>0 AND REF(DDZ,1)<0,1,0);
T2Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)<0,2,T1Z);
T3Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)<0,3,T2Z);
T4Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)<0,4,T3Z);
T5Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)>0 AND REF(DDZ,5)<0,5,T4Z);
T6Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)>0 AND REF(DDZ,5)>0 AND REF(DDZ,6)<0,6,T5Z);
T7Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)>0 AND REF(DDZ,5)>0 AND REF(DDZ,6)>0 AND REF(DDZ,7)<0,7,T6Z);
T8Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)>0 AND REF(DDZ,5)>0 AND REF(DDZ,6)>0 AND REF(DDZ,7)>0 AND REF(DDZ,8)<0,8,T7Z);
T9Z:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)>0 AND REF(DDZ,5)>0 AND REF(DDZ,6)>0 AND REF(DDZ,7)>0 AND REF(DDZ,8)>0 AND REF(DDZ,9)<0,9,T8Z);
TZ:=IF (DDZ>0 AND REF(DDZ,1)>0 AND REF(DDZ,2)>0 AND REF(DDZ,3)>0 AND REF(DDZ,4)>0 AND REF(DDZ,5)>0 AND REF(DDZ,6)>0 AND REF(DDZ,7)>0 AND REF(DDZ,8)>0 AND REF(DDZ,9)>0,10,T9Z);
DRAWTEXT_FIX(1,0.112,0.745,0,STRCAT(STRCAT(' ',CON2STR(TZ,0)),' [天] ')),COLORWHITE;
T11:=IF (DDY>0 AND REF(DDY,1)<0,1,0);
T21:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)<0,2,T11);
T31:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)<0,3,T21);
T41:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)<0,4,T31);
T51:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)>0 AND REF(DDY,5)<0,5,T41);
T61:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)>0 AND REF(DDY,5)>0 AND REF(DDY,6)<0,6,T51);
T71:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)>0 AND REF(DDY,5)>0 AND REF(DDY,6)>0 AND REF(DDY,7)<0,7,T61);
T81:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)>0 AND REF(DDY,5)>0 AND REF(DDY,6)>0 AND REF(DDY,7)>0 AND REF(DDY,8)<0,8,T71);
T91:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)>0 AND REF(DDY,5)>0 AND REF(DDY,6)>0 AND REF(DDY,7)>0 AND REF(DDY,8)>0 AND REF(DDY,9)<0,9,T81);
TY1:=IF (DDY>0 AND REF(DDY,1)>0 AND REF(DDY,2)>0 AND REF(DDY,3)>0 AND REF(DDY,4)>0 AND REF(DDY,5)>0 AND REF(DDY,6)>0 AND REF(DDY,7)>0 AND REF(DDY,8)>0 AND REF(DDY,9)>0,10,T91);
DRAWTEXT_FIX(1,0.293,0.755,0,STRCAT(STRCAT(' ',CON2STR(TY1,0)),' [天] ')),COLORWHITE;
T1:=IF (DDX>0 AND REF(DDX,1)<0,1,0);
T2:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)<0,2,T1);
T3:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)<0,3,T2);
T4:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)<0,4,T3);
T5:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)>0 AND REF(DDX,5)<0,5,T4);
T6:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)>0 AND REF(DDX,5)>0 AND REF(DDX,6)<0,6,T5);
T7:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)>0 AND REF(DDX,5)>0 AND REF(DDX,6)>0 AND REF(DDX,7)<0,7,T6);
T8:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)>0 AND REF(DDX,5)>0 AND REF(DDX,6)>0 AND REF(DDX,7)>0 AND REF(DDX,8)<0,8,T7);
T9:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)>0 AND REF(DDX,5)>0 AND REF(DDX,6)>0 AND REF(DDX,7)>0 AND REF(DDX,8)>0 AND REF(DDX,9)<0,9,T8);
T:=IF (DDX>0 AND REF(DDX,1)>0 AND REF(DDX,2)>0 AND REF(DDX,3)>0 AND REF(DDX,4)>0 AND REF(DDX,5)>0 AND REF(DDX,6)>0 AND REF(DDX,7)>0 AND REF(DDX,8)>0 AND REF(DDX,9)>0,10,T9);
DRAWTEXT_FIX(1,0.465,0.755,0,STRCAT(STRCAT(' ',CON2STR(T,0)),' [天] ')),COLORWHITE;
主力净买量:=(LARGEINTRDVOL-LARGEOUTTRDVOL);
TMP:=LARGEINTRDVOL-LARGEOUTTRDVOL;
主力活跃度:=(LARGEINTRDVOL+LARGEOUTTRDVOL)*10000/(2*FINANCE(7));
主力资金线:=(L2_AMO(0,0)+L2_AMO(1,0)-L2_AMO(0,1)-L2_AMO(1,1))/10000.0;
DRAWRECTREL(2,885,160,818,IF(CONST(主力净买量)>0,RGB(192,17,27),RGB(0,50,0)));
DRAWRECTREL(175,885,343,818,IF(CONST(TMP)>0,RGB(192,17,27),RGB(0,50,0)));
DRAWRECTREL(358,885,520,818,IF(CONST(主力资金线)>0,RGB(192,17,27),RGB(0,50,0)));
DRAWTEXT_FIX(1,0.005,0.825,0,STRCAT('主力净买量:',CON2STR(主力净买量,2))),COLORWHITE;
DRAWTEXT_FIX(1,0.184,0.825,0,STRCAT('主力活跃度:',CON2STR(主力活跃度,2))),COLORWHITE;
DRAWTEXT_FIX(1,0.363,0.825,0,STRCAT('主力资金线:',CON2STR(主力资金线,2))),COLORWHITE;
现手买:=BUYVOL*DYNAINFO(7)*100/10000 COLOR0000FF,NODRAW;
现手卖:=SELLVOL*DYNAINFO(7)*100/10000 COLOR00FF00,NODRAW;
合:=ABS(现手买)+ABS(现手卖)COLOR80FFFF,NODRAW;
差:=ABS(现手买)-ABS(现手卖)COLOR80FFFF,NODRAW;
MPB1:=ABS(现手买)/合*100;
MPB2:=ABS(现手卖)/合*100;
TESTSKIP(NOT(现手买 OR 现手卖 OR 合 OR 差 OR MPB1 OR MPB2)!=0);
DRAWRECTREL(640,940,940,1000,RGB(160,160,190));
DRAWRECTREL(790-现手卖*210/合,940,790,1000,RGB(0,128,0));
DRAWRECTREL(790,940,790+现手买*210/合,1000,RGB(128,0,0));
DRAWRECTREL(789.8,940,790.2,1000,RGB(0,0.0,10));
DRAWRECTREL(639.8,940,640.2,1000,RGB(0,0,10));
DRAWRECTREL(939.8,940,940.2,1000,RGB(0,0,10));
DRAWRECTREL(0,940,1000,940.2,RGB(0,0,10));
DRAWTEXT_FIX(1,0.9,0.88,0,STRCAT(STRCAT('',CON2STR(现手买,1)),'万')),COLOR0000FF;
DRAWTEXT_FIX(1,0.61,0.88,0,STRCAT(STRCAT('',CON2STR(现手卖,1)),'万')),COLOR00FF00;
DRAWTEXT_FIX(1,0.755,0.88,0,STRCAT(STRCAT('',CON2STR(差,1)),'万')),COLOR0080FF;
DRAWTEXT_FIX(1,0.58,0.97,0,STRCAT(STRCAT(' ',CON2STR(MPB2,1)),'%%')),COLOR00FF00;
DRAWTEXT_FIX(1,0.94,0.97,0,STRCAT(STRCAT('',CON2STR(MPB1,1)),'%%')),COLOR0000FF;

1332500945.png

1332500945.png

133311861.png

133311861.png

回复

使用道具 举报

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

本版积分规则