通达信分时弹压主图指标公式

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

长趋势:=13;
{DRAWGBK(C>0,RGB(0,0,0),RGB(0,0,0),0,'56',0),LINETHICK2;}
DRAWRECTREL(990,1,0,1,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.01,0.00,0,'0'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.00,0,'100'),COLOR00CCCC;
DRAWRECTREL(990,189,0,189,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.01,0.189,0,'19.1'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.189,0,'80.9'),COLORWHITE;
DRAWRECTREL(990,375,0,375,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.01,0.376,0,'38.2'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.376,0,'61.8'),COLORWHITE;
DRAWRECTREL(990,491,0,491,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.01,0.492,0,'50.0'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.492,0,'50.0'),COLORWHITE;
DRAWRECTREL(990,607,0,607,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.01,0.608,0,'61.8'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.608,0,'38.2'),COLORWHITE;
DRAWRECTREL(990,794,0,794,RGB(200,200,0));
DRAWTEXT_FIX(C>0,0.01,0.795,0,'80.9'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.795,0,'19.1'),COLORWHITE;
DRAWRECTREL(990,982,0,982,RGB(250,250,0));
DRAWTEXT_FIX(C>0,0.01,0.936,0,'BASE'),COLOR00CCCC;
DRAWTEXT_FIX(C>0,0.970,0.936,0,'0'),COLOR00CCCC;
年:=YEAR,NODRAW;
月:=MONTH,NODRAW;
星期:=WEEKDAY,NODRAW;
日1:=DATETODAY(DATE);
上市日:=REF(DATE,TOTALBARSCOUNT-CURRBARSCOUNT);
自然日:=日1-DATETODAY(上市日)+1;
ZB:=(自然日-REF(自然日,1))!=星期-REF(星期,1) OR TOTALBARSCOUNT-CURRBARSCOUNT=0;
本周第几天:=BARSLAST(ZB)+1;
本月第几天:=BARSLAST(年*100+月!=REF(年*100+月,1))+1;
MA1:=REF(C,本周第几天);
MA2:=REF(MA1,本周第几天);
MA3:=REF(MA2,本周第几天);
MA4:=REF(MA3,本周第几天);
MA5:=REF(MA4,本周第几天);
MA6:=REF(MA5,本周第几天);
MA7:=REF(MA6,本周第几天);
MA8:=REF(MA7,本周第几天);
MA9:=REF(MA8,本周第几天);
十周价:=(C+MA1+MA2+MA3+MA4+MA5+MA6+MA7+MA8+MA9)/10;
决策:REFDATE(十周价,DATE),COLORFF0080,LINETHICK2;
DRAWTEXT(ISLASTBAR,决策,' 决策线'),COLORFF0080;
SUM(AMOUNT,0)/SUM(VOL,0)/100 ,LINETHICK1,COLORYELLOW;
DRAWICON(CROSS(C,决策),C,1);
V1:=TIME;
A1:=COUNT(BARSCOUNT(C)=1 AND TIME<102000 ,0 );
T:=IF(V1<130000,(FLOOR(V1/10000)-9.5)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000)),(FLOOR(V1/10000)-11)*60+(FLOOR(V1/100)-100*FLOOR(V1/10000))),NODRAW;
时间:=TIME=100000;
N:=BARSLAST(时间),COLOR808080;
常数:=CONST(IF(N=0,C,REF(C,N))),COLOR004848,DOTLINE;
CS1:=CONST(IF(N,HHV(H,0),REF(HHV(H,0),N))),COLOR808080;
CS2:=CONST(IF(N,LLV(L,0),REF(LLV(L,0),N))),COLOR808080;
{STICKLINE(时间=1,CS1,CS2,-1,0),COLOR808080;}
H01:=MAX(DYNAINFO(3),DYNAINFO(5));
L01:=MIN(DYNAINFO(3),DYNAINFO(6));
P1:=H01-L01;
阻力:L01+P1*7/8,COLOR00FFFF,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=1,阻力,'阻力'),COLOR00FFFF;
{DRAWTEXT_FIX(1,0.00,0,0,'所属行业:')COLOR0080FF;
DRAWTEXT_FIX(1,0.07,0,0,HYBLOCK)COLOR0080FF;
DRAWTEXT_FIX(1,0.14,0,0,'所属地区:')COLOR00FFFF;
DRAWTEXT_FIX(1,0.21,0,0,DYBLOCK)COLOR00FFFF;
DRAWTEXT_FIX(1,0.01,0.08,0,'主题投资:')COLOR0000FF;
DRAWTEXT_FIX(1,0.09,0.08,0,EXTERNSTR(0,1))COLOR0000FF;} {生成数据时第1项输1与这里1一致,描述部分输"主题投资"}
最新0:C,LINETHICK9,COLORFFFF00;
IF(C>=REF(C,1),C,DRAWNULL),LINETHICK9,COLOR0909FF;
AA0:=SUM(AMOUNT,BARSCOUNT(C))/SUM(VOL*100,BARSCOUNT(C));
BB0:=BETWEEN(C/AA0,C+H,C-H);
TT3:=BARSCOUNT(C)+1;
M:=SUM(V*C,TT3)/SUM(V,TT3),COLORYELLOW;
P2:=240;
TC1:=IF(H=HHV(H,P2),C,DRAWNULL);
TC2:=CONST(BARSLAST(TC1=H))+1;
UPPER:=CONST(IF(TC2=1,C,REF(C,TC2-1)));
BC1:=IF(L=LLV(L,P2),C,DRAWNULL);
BC2:=CONST(BARSLAST(BC1=L))+1;
LOWER:=CONST(IF(BC2=1,C,REF(C,BC2-1)));
LP:=CURRBARSCOUNT<=BC2 AND C=LOWER;{低点定位}
HP:=CURRBARSCOUNT<=TC2 AND C=UPPER;{高点定位}
低:=LOWER;
高:=UPPER;
TTT:=MAX(TC2,BC2);
ZZ:=(高+低)/2;
ZH:=(高+ZZ)/2;
ZL:=(ZZ+低)/2;
EE:=CURRBARSCOUNT<=TTT;
中低:IF(EE,ZL,DRAWNULL),COLOR0099FF,LINETHICK1,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=5,中低,'中低'),COLORFFFFFF;
中高:IF(EE,ZH,DRAWNULL),COLORFF9900,LINETHICK1,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=5,中高,'中高'),COLORFFFFFF,LINETHICK2;
标准:IF(EE,ZZ,DRAWNULL),COLORWHITE,LINETHICK1,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=5,标准,'标准'),COLORFFFFFF,LINETHICK2;
高点:IF(EE,高,DRAWNULL),COLOR00FFCC,LINETHICK1,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=6,高点,'高'),COLORFFFFFF,LINETHICK2;
低点:IF(EE,低,DRAWNULL),COLOR00CC00,LINETHICK1,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=1,低点,'低'),COLORFFFFFF,LINETHICK2;
{均价:SUM(V*C,0)/SUM(V,0),COLORWHITE,DOTLINE;
DRAWTEXT(CURRBARSCOUNT=6,均价,'均'),COLORFFFFFF,LINETHICK2;}
最新:C,LINETHICK9,COLORFFFF00;
IF(C>=REF(C,1),C,DRAWNULL),LINETHICK9,COLORRED;
AA:=SUM(AMOUNT,BARSCOUNT(C))/SUM(VOL*100,BARSCOUNT(C));
BB:=BETWEEN(C/AA,C+H,C-H);
{分时均线}
W:=BARSLAST(DAY-REF(DAY,1))+1;
均价:SUM(CLOSE*VOL,W)/SUM(VOL,W),LINETHICK2,COLORYELLOW;
IF(均价<REF(均价,1),均价,DRAWNULL),LINETHICK2,COLORGREEN;
DRAWTEXT(ISLASTBAR,均价,' 当日均线'),COLORWHITE;
B:=BARSCOUNT(C);
D2:=BARSLAST(B);
HH:=HHV(H,D2);
DRAWTEXT(BARSTATUS=1,HH,STKNAME+' '+STKNAME+' '),COLORRED;
换手率:=100*V/CAPITAL,COLORFFFFFF;
RH:=H-L;
R:=DYNAINFO(13)*100;
A:=BARSSINCE(V>0)+1;
FS:=SUM(C*V,A)/SUM(V,A);
GJ:=(C+H+L+O)/4;
明日阻力:=L+(GJ-L)+(C-L);
明日支撑:=L+(C-GJ);
明日阻力2:=L+2*(GJ-L)+(C-L);
明日支撑2:=L+(C-GJ)-(GJ-L);
今日阻力:CONST(REF(明日阻力 , 1));
今日支撑:CONST(REF(明日支撑 , 1));
今日阻力2:CONST(REF(明日阻力2 , 1));
今日支撑2:CONST(REF(明日支撑2 , 1));
DRAWTEXT(ISLASTBAR,今日阻力,' -------------阻'),COLOR0000FF;
DRAWTEXT(ISLASTBAR,今日支撑,' -------------------------支'),COLOR00FF00;
DRAWTEXT(BARSTATUS=2 ,HH,'----------------------------------HH'),COLORFFFFFF;
DRAWTEXT(BARSTATUS=2 AND V>REF(V,1) AND MA(V,5)>REF(MA(V,5),1),HH,'今日成交量大于昨日,且有继续增大趋势'+' '),COLOR8285FF;
DRAWTEXT(BARSTATUS=2 AND V<REF(V,1) AND MA(V,5)>REF(MA(V,5),1),HH,'今日成交量小于昨日,但有放大迹象'+' '),COLOR8285FF;
DRAWTEXT(BARSTATUS=2 AND V>REF(V,1)AND MA(V,5)<REF(MA(V,5),1),HH,'今日成交量大于昨日, 但有缩小迹象'+' '),COLOR8285FF;
DRAWTEXT(BARSTATUS=2 AND V<REF(V,1)AND MA(V,5)<REF(MA(V,5),1),HH,'今日成交量小于昨日,且有缩小迹象'+' '),COLOR8285FF;
{时间设置};
机构净流:="资金方程.机构净流#DAY";
游资净流:="资金方程.游资净流#DAY";
中户净流:="资金方程.中户净流#DAY";
散户净流:="资金方程.散户净流#DAY";
当日净买:="资金方程.净流入#DAY";
五日净买:="资金方程.五流入#DAY";
O5:="分时引用1.O5#DAY";
C5:="分时引用1.C5#DAY";
H5:="分时引用1.H5#DAY";
L5:="分时引用1.L5#DAY";
O4:="分时引用1.O4#DAY";
C4:="分时引用1.C4#DAY";
H4:="分时引用1.H4#DAY";
L4:="分时引用1.L4#DAY";
O3:="分时引用1.O3#DAY";
C3:="分时引用1.C3#DAY";
H3:="分时引用1.H3#DAY";
L3:="分时引用1.L3#DAY";
O2:="分时引用1.O2#DAY";
C2:="分时引用1.C2#DAY";
H2:="分时引用1.H2#DAY";
L2:="分时引用1.L2#DAY";
O1:="分时引用1.O1#DAY";
C1:="分时引用1.C1#DAY";
H1:="分时引用1.H1#DAY";
L1:="分时引用1.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);
新高:=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,6,0),COLORLIRED;
STICKLINE(XD,均价,C*0.998,4,0),COLORCYAN;
时5:MA(C,300),COLORMAGENTA;
T0:=CURRBARSCOUNT;
A5:="MAA.MA1#DAY";
A25:="MAA.MA2#DAY";
GJ0:=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,LINETHICK2;
DRAWTEXT(ISLASTBAR,日5, '← 5均'),COLOR888888;
DRAWTEXT(ISLASTBAR,日25,'←趋势'),COLORGREEN;
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;
AA00:=REF(H,长趋势)=HHV(H,2*长趋势+1);
QY:=BACKSET(AA00,长趋势+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,LINETHICK3;

202108201340.jpg

202108201340.jpg

 

回复

使用道具 举报

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

本版积分规则