股票选股公式编写教程 通达信分时弹压 资金方程源码
引用公式:资金方程
JGV:=(L2_VOL(0,0) - L2_VOL(0,1))*VOL/1000;
DHV:=(L2_VOL(1,0) - L2_VOL(1,1))*VOL/1000;
ZHV:=(L2_VOL(2,0) - L2_VOL(2,1))*VOL/1000;
SHV:=(L2_VOL(3,0) - L2_VOL(3,1))*VOL/1000;
超B:=L2_AMO(0,2)/100000000.0;
大B:=L2_AMO(1,2)/100000000.0;
中B:=L2_AMO(2,2)/100000000.0;
小B:=L2_AMO(3,2)/100000000.0;
超S:=-L2_AMO(0,3)/100000000.0;
大S:=-L2_AMO(1,3)/100000000.0;
中S:=-L2_AMO(2,3)/100000000.0;
小S:=-L2_AMO(3,3)/100000000.0;
净流入:(超B+大B+中B+小B)+(超S+大S+中S+小S),NODRAW;
五流入:净流入+REF(净流入,1)+REF(净流入,2)+REF(净流入,3)+REF(净流入,4),NODRAW;
机构净流:超B+超S,NODRAW;
游资净流:大B+大S,NODRAW;
中户净流:中B+中S,NODRAW;
散户净流:小B+小S,NODRAW;
大单动向:(LARGEINTRDVOL-LARGEOUTTRDVOL)*10000/FINANCE(7),NODRAW;
N天内红:COUNT(DDX>0,10),COLORRED,NODRAW;
N连红天:BARSLASTCOUNT(DDX>0)NODRAW;
{分时弹压}
参数:长趋势(1,500,13)
机构净流:="资金方程.机构净流#DAY";
游资净流:="资金方程.游资净流#DAY";
中户净流:="资金方程.中户净流#DAY";
散户净流:="资金方程.散户净流#DAY";
当日净买:="资金方程.净流入#DAY";
五日净买:="资金方程.五流入#DAY";
O5:="分时引用.O5#DAY";
C5:="分时引用.C5#DAY";
H5:="分时引用.H5#DAY";
L5:="分时引用.L5#DAY";
O4:="分时引用.O4#DAY";
C4:="分时引用.C4#DAY";
H4:="分时引用.H4#DAY";
L4:="分时引用.L4#DAY";
O3:="分时引用.O3#DAY";
C3:="分时引用.C3#DAY";
H3:="分时引用.H3#DAY";
L3:="分时引用.L3#DAY";
O2:="分时引用.O2#DAY";
C2:="分时引用.C2#DAY";
H2:="分时引用.H2#DAY";
L2:="分时引用.L2#DAY";
O1:="分时引用.O1#DAY";
C1:="分时引用.C1#DAY";
H1:="分时引用.H1#DAY";
L1:="分时引用.L1#DAY";
O0:=DYNAINFO(4);
C0:=DYNAINFO(7);
H0:=DYNAINFO(5);
L0:=DYNAINFO(6);
HH1:=MAX(H1,H2);
HH2:=MAX(H3,H4);
HH3:=MAX(MAX(H0,H5),MAX(HH1,HH2));
LL1:=MIN(L1,L2);
LL2:=MIN(L3,L4);
LL3:=MIN(MIN(L0,L5),MIN(LL1,LL2));
HL:=999/(HH3-LL3);
C52:=999-((C5-LL3)*HL);
H52:=999-((H5-LL3)*HL);
L52:=999-((L5-LL3)*HL);
O52:=999-((O5-LL3)*HL);
C42:=999-((C4-LL3)*HL);
H42:=999-((H4-LL3)*HL);
L42:=999-((L4-LL3)*HL);
O42:=999-((O4-LL3)*HL);
C32:=999-((C3-LL3)*HL);
H32:=999-((H3-LL3)*HL);
L32:=999-((L3-LL3)*HL);
O32:=999-((O3-LL3)*HL);
C22:=999-((C2-LL3)*HL);
H22:=999-((H2-LL3)*HL);
L22:=999-((L2-LL3)*HL);
O22:=999-((O2-LL3)*HL);
C12:=999-((C1-LL3)*HL);
H12:=999-((H1-LL3)*HL);
L12:=999-((L1-LL3)*HL);
O12:=999-((O1-LL3)*HL);
C02:=999-((C0-LL3)*HL);
H02:=999-((H0-LL3)*HL);
L02:=999-((L0-LL3)*HL);
O02:=999-((O0-LL3)*HL);
DRAWRECTREL( 8,H52, 8,L52,RGB(IF(C5>=O5,200,0),IF(C5>=O5,0,200),0));
DRAWRECTREL( 0,C52,16,O52,RGB(IF(C5>=O5,128,0),IF(C5>=O5,0,128),0));
DRAWRECTREL(28,H42,28,L42,RGB(IF(C4>=O4,200,0),IF(C4>=O4,0,200),0));
DRAWRECTREL(20,C42,36,O42,RGB(IF(C4>=O4,128,0),IF(C4>=O4,0,128),0));
DRAWRECTREL(48,H32,48,L32,RGB(IF(C3>=O3,200,0),IF(C3>=O3,0,200),0));
DRAWRECTREL(40,C32,56,O32,RGB(IF(C3>=O3,128,0),IF(C3>=O3,0,128),0));
DRAWRECTREL(68,H22,68,L22,RGB(IF(C2>=O2,200,0),IF(C2>=O2,0,200),0));
DRAWRECTREL(60,C22,76,O22,RGB(IF(C2>=O2,128,0),IF(C2>=O2,0,128),0));
DRAWRECTREL(88,H12,88,L12,RGB(IF(C1>=O1,200,0),IF(C1>=O1,0,200),0));
DRAWRECTREL(80,C12,96,O12,RGB(IF(C1>=O1,128,0),IF(C1>=O1,0,128),0));
DRAWRECTREL(108,H02,108,L02,RGB(IF(C0>=O0,200,0),IF(C0>=O0,0,200),0));
DRAWRECTREL(100,C02,116,O02,RGB(IF(C0>=O0,128,0),IF(C0>=O0,0,128),0));
{分时弹压}
BAA:=(DYNAINFO(5)-DYNAINFO(3))/DYNAINFO(3)*100;
BAB:=ABS((DYNAINFO(6)-DYNAINFO(3))/DYNAINFO(3)*100);
BAC:=MAX(BAA,BAB);
昨收:=DYNAINFO(3);
今开:=DYNAINFO(4),COLORLICYAN;
现价:=DYNAINFO(7);
均价:SUM(C*V,0)/SUM(V,0),COLORYELLOW;
新高:=HHV(H,480);
新低:=LLV(L,480);
EAA:=(CLOSE-新高)/新高*100;
EAB:=(CLOSE-新低)/新低*100;
XG:=FILTER(CROSS(C,REF(新高,1)),10);
XD:=FILTER(CROSS(C,REF(新低,1)),10);
STICKLINE(XG,均价,C*1.002,8,0),COLORLIRED;
STICKLINE(XD,均价,C*0.998,8,0),COLORCYAN;
时5:MA(C,300),COLORMAGENTA;
T:=CURRBARSCOUNT;
A5:="分时引用.MA1#DAY";
A25:="分时引用.MA2#DAY";
GJ:=400;
CAA:=(CLOSE-A5)/A5*100;
CAB:=(CLOSE-A25)/A25*100;
日5:IF(C<GJ AND BETWEEN(CAA,BAC,REVERSE(BAC)),A5,DRAWNULL),COLOR888888;
日25:IF(C<GJ AND BETWEEN(CAB,BAC,REVERSE(BAC)),A25,DRAWNULL),COLORRED,LINETHICK1;
IF(现价<日25 AND BETWEEN(CAB,BAC,REVERSE(BAC)),日25,DRAWNULL),COLORGREEN,LINETHICK1;
DRAWTEXT(T=4,日5, '← 5均'),COLOR888888;
DRAWTEXT(T=6,日25,'←趋势'),COLOR888888;
VAR2W:=100-100*(HHV(HIGH,14)-CLOSE)/(HHV(HIGH,14)-LLV(LOW,14));
MW:= EMA(VAR2W,3);
VAR3W:=EMA(VAR2W,7);
M1:= EMA(VAR3W,5);
M2:= C>MA(CLOSE,5);
反弹:((CROSS(MW,M1) AND M1<20) AND M2)NODRAW;
DRAWTEXT(CROSS(MW,M1) AND M1<20 AND M2 AND A5>A25,L,'★'),COLORYELLOW;
VAR01:=(HIGH+LOW+CLOSE)/3;
VAR02:=(VAR01-MA(VAR01,14))/(0.015*AVEDEV(VAR01,14));
VAR03:=(VAR01-MA(VAR01,70))/(0.015*AVEDEV(VAR01,70));
VAR04:=IF(VAR02>=150 AND VAR02<200 AND VAR03>=150 AND VAR03<200,10,0);
VAR05:=IF(VAR02<=-150 AND VAR02>-200 AND VAR03<=-150 AND VAR03>-200,-10,VAR04);
VAR1B:=IF(VAR03>=200 AND VAR02>=150,15,IF(VAR03<=-200 AND VAR02<=-150,-15,VAR05))+60;
DRAWTEXT(FILTER(VAR1B=75,5),H,'★'),COLORGREEN;
AA:=REF(H,长趋势)=HHV(H,2*长趋势+1);
QY:=BACKSET(AA,长趋势+1);
CC:=FILTER(QY,长趋势) AND H=HHV(H,长趋势+1);
DDD:=BARSLAST(CC);
GDTS:=IF(CC,CURRBARSCOUNT,0);
DINGBU:=IF(DDD,REF(H,DDD),H);
DINGBUTS:=IF(DDD,REF(GDTS,DDD),GDTS);
DINGBU1:=REF(DINGBU,DDD+1);
GDCS1:=CONST(DINGBUTS);
DINGBUTS1:=REF(DINGBUTS,DDD+1);
GDCS2:=CONST(DINGBUTS1);
DINGBU2:=REF(DINGBU1,DDD+1);
MM1:=IF(CURRBARSCOUNT>GDCS2,0,1);
长上轨:DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1),COLORMAGENTA,LINETHICK1;
AA1:=REF(L,长趋势)=LLV(L,2*长趋势+1);
QY1:=BACKSET(AA1,长趋势+1);
CC1:=FILTER(QY1,长趋势) AND L=LLV(L,长趋势+1);
DD1:=BARSLAST(CC1);
DDTS:=IF(CC1,CURRBARSCOUNT,0);
YDB:=IF(DD1,REF(L,DD1),L);
DDTS1:=IF(DD1,REF(DDTS,DD1),DDTS);
DDCS1:=CONST(DDTS1);
ZDB:=REF(YDB,DD1+1);
DDTS2:=REF(DDTS1,DD1+1);
DDCS2:=CONST(DDTS2);
长下轨:DRAWLINE(CURRBARSCOUNT=DDCS2,L,CURRBARSCOUNT=DDCS1,L,1),COLORMAGENTA,LINETHICK1;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(机构净流)>0,0.01,0.70,0,STRCAT(STRCAT('机构+ ',CON2STR(机构净流,2)),'亿')),COLORLIRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(机构净流)<0,0.01,0.70,0,STRCAT(STRCAT('机构 ',CON2STR(机构净流,2)),'亿')),COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(机构净流)=0,0.01,0.70,0,STRCAT(STRCAT('机构= ',CON2STR(机构净流,2)),'')),COLORYELLOW;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(游资净流)>0,0.01,1.0,0,STRCAT(STRCAT('游资+ ',CON2STR(游资净流,2)),'亿')),COLORLIRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(游资净流)<0,0.01,1.0,0,STRCAT(STRCAT('游资 ',CON2STR(游资净流,2)),'亿')),COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(游资净流)=0,0.01,1.0,0,STRCAT(STRCAT('游资= ',CON2STR(游资净流,2)),' ')),COLORYELLOW;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(中户净流)>0,0.35,0.70,0,STRCAT(STRCAT('中户+ ',CON2STR(中户净流,2)),'亿')),COLORLIRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(中户净流)<0,0.35,0.70,0,STRCAT(STRCAT('中户 ',CON2STR(中户净流,2)),'亿')),COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(中户净流)=0,0.35,0.70,0,STRCAT(STRCAT('中户= ',CON2STR(中户净流,2)),' ')),COLORYELLOW;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(散户净流)>0,0.35,1.0,0,STRCAT(STRCAT('散户+ ',CON2STR(散户净流,2)),'亿')),COLORLIRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(散户净流)<0,0.35,1.0,0,STRCAT(STRCAT('散户 ',CON2STR(散户净流,2)),'亿')),COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(散户净流)=0,0.35,1.0,0,STRCAT(STRCAT('散户= ',CON2STR(散户净流,2)),' ')),COLORYELLOW;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(当日净买)>0,0.70,0.70,0,STRCAT('当日净买+ ',STRCAT(CON2STR(当日净买,2),'亿'))) COLOR0000FF;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(当日净买)<0,0.70,0.70,0,STRCAT('当日净买 ',STRCAT(CON2STR(当日净买,2),'亿'))) COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(五日净买)>0,0.70,1.0,0,STRCAT('五日净买+ ',STRCAT(CON2STR(五日净买,2),'亿'))) COLOR0000FF;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(五日净买)<0,0.70,1.0,0,STRCAT('五日净买 ',STRCAT(CON2STR(五日净买,2),'亿'))) COLOR00FF00;