股资源-股票学习站-学炒股-股票课程-炒股教程-分析选股指标-入门基础知识

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[通达信] 自动画线(主图 指标 低点支撑 高点压力 明日阻力 下降压力线)


    [-----复制链接-----]
楼主
 通达信源码安装路径:1,工具栏点击公式选项。2,弹出公式窗口点击新建。3,把源码复制到指标编辑器保存。4,回到K线图界面安装建立好的公式 || 2023-10-9 11:07:48

以下是自动画线(主图 指标 低点支撑 高点压力 明日阻力 下降压力线)

下降压力线:DRAWLINE(HIGH>=HHV(HIGH,10),HIGH,LOW<=LLV(LOW,3),HHV(HIGH,3),1),LINETHICK2,COLORWHITE;
N1:=20;
N2:=10;
N3:=5;
GJ:=(C+H+L+O)/4;
明日阻力:=L+(GJ-L)+(C-L);
明日支撑:=L+(C-GJ);
今日阻力:=REF(明日阻力 , 1),NODRAW;
今日支撑:=REF(明日支撑 , 1),NODRAW;
支:STICKLINE(ISLASTBAR AND C>=今日阻力,今日阻力,今日阻力,30,1),COLOR0000FF;
压:STICKLINE(ISLASTBAR AND C<今日阻力,今日阻力,今日阻力,30,1),COLOR00FF00;
支1:STICKLINE(ISLASTBAR AND C>=今日支撑,今日支撑,今日支撑,30,1),COLORFF00FF;
压1:STICKLINE(ISLASTBAR AND C<今日支撑,今日支撑,今日支撑,30,1),COLORFF8800;
AA:=REF(H,N1)=HHV(H,2*N1+1);
QY:=BACKSET(AA,N1+1);
CC:=FILTER(QY,N1) AND H=HHV(H,N1+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);
MM:=IF(CURRBARSCOUNT>GDCS2,0,1);
高点压力:=DRAWLINE(CURRBARSCOUNT=GDCS2,H,CURRBARSCOUNT=GDCS1,H,1),COLORYELLOW;

AA1:=REF(L,N1)=LLV(L,2*N1+1);
QY1:=BACKSET(AA1,N1+1);
CC1:=FILTER(QY1,N1) AND L=LLV(L,N1+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),COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=DDCS2,L,ISLASTBAR,REF(L,DDCS2-1),1),COLORYELLOW,POINTDOT,LINETHICK2;
DRAWLINE(CURRBARSCOUNT=DDCS1,L,ISLASTBAR,REF(L,DDCS1-1),1),COLORYELLOW,POINTDOT,LINETHICK2;
LAA:=REF(H,N2)=HHV(H,2*N2+1);
LQY:=BACKSET(LAA,N2+1);
LCC:=FILTER(LQY,N2) AND H=HHV(H,N2+1);
LDDD:=BARSLAST(LCC);
LGDTS:=IF(LCC,CURRBARSCOUNT,0);
LDINGBU:=IF(LDDD,REF(H,LDDD),H);{顶部}
LDINGBUTS:=IF(LDDD,REF(LGDTS,LDDD),LGDTS);
LDINGBU1:=REF(LDINGBU,LDDD+1);
LGDCS1:=CONST(LDINGBUTS);
LDINGBUTS1:=REF(LDINGBUTS,LDDD+1);
LGDCS2:=CONST(LDINGBUTS1);
LDINGBU2:=REF(LDINGBU1,LDDD+1);
LMM:=IF(CURRBARSCOUNT>LGDCS2,0,1);
压力:DRAWLINE(CURRBARSCOUNT=LGDCS2,H,CURRBARSCOUNT=LGDCS1,H,1),COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=LGDCS2,H,ISLASTBAR,REF(H,LGDCS2-1),1),,POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=LGDCS1,H,ISLASTBAR,REF(H,LGDCS1-1),1),,POINTDOT,COLORYELLOW;
LAA1:=REF(L,N2)=LLV(L,2*N2+1);
LQY1:=BACKSET(LAA1,N2+1);
LCC1:=FILTER(LQY1,N2) AND L=LLV(L,N2+1);
LDD1:=BARSLAST(LCC1);
LDDTS:=IF(LCC1,CURRBARSCOUNT,0);
LYDB:=IF(LDD1,REF(L,LDD1),L);
LDDTS1:=IF(LDD1,REF(LDDTS,LDD1),LDDTS);
LDDCS1:=CONST(LDDTS1);
LZDB:=REF(LYDB,LDD1+1);
LDDTS2:=REF(LDDTS1,DD1+1);
LDDCS2:=CONST(LDDTS2);
支撑:DRAWLINE(CURRBARSCOUNT=LDDCS2,L,CURRBARSCOUNT=LDDCS1,L,1),;
ZGSTAR:=(压力+支撑)/2;
ZGEND:=CONST((压力+支撑)/2);
STARDAY:=IF(DDCS2<GDCS2,DDCS2,GDCS2);
中轨:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),COLORYELLOW;
LLAA:=REF(H,N3)=HHV(H,2*N3+1);
LLQY:=BACKSET(LLAA,N3+1);
LLCC:=FILTER(LLQY,N3) AND H=HHV(H,N3+1);
LLDDD:=BARSLAST(LLCC);
LLGDTS:=IF(LLCC,CURRBARSCOUNT,0);
LLDINGBU:=IF(LLDDD,REF(H,LLDDD),H);{顶部}
LLDINGBUTS:=IF(LLDDD,REF(LLGDTS,LLDDD),LLGDTS);
LLDINGBU1:=REF(LLDINGBU,LLDDD+1);
LLGDCS1:=CONST(LLDINGBUTS);
LLDINGBUTS1:=REF(LLDINGBUTS,LLDDD+1);
LLGDCS2:=CONST(LLDINGBUTS1);
LLDINGBU2:=REF(LLDINGBU1,LLDDD+1);
LLMM:=IF(CURRBARSCOUNT>LGDCS2,0,1);
L压力:DRAWLINE(CURRBARSCOUNT=LLGDCS2,H,CURRBARSCOUNT=LLGDCS1,H,1),COLORYELLOW ;
DRAWLINE(CURRBARSCOUNT=LLGDCS2,H,ISLASTBAR,REF(H,LLGDCS2-1),1),,POINTDOT,COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=LLGDCS1,H,ISLASTBAR,REF(H,LLGDCS1-1),1),,POINTDOT,COLORYELLOW;
LLAA1:=REF(L,N3)=LLV(L,2*N3+1);
LLQY1:=BACKSET(LLAA1,N3+1);
LLCC1:=FILTER(LLQY1,N3) AND L=LLV(L,N3+1);
LLDD1:=BARSLAST(LCC1);
LLDDTS:=IF(LLCC1,CURRBARSCOUNT,0);
LLYDB:=IF(LLDD1,REF(L,LLDD1),L);
LLDDTS1:=IF(LLDD1,REF(LLDDTS,LLDD1),LDDTS);
LLDDCS1:=CONST(LLDDTS1);
LLZDB:=REF(LLYDB,LLDD1+1);
LLDDTS2:=REF(LLDDTS1,DD1+1);
LLDDCS2:=CONST(LLDDTS2);
L支撑:DRAWLINE(CURRBARSCOUNT=LLDDCS2,L,CURRBARSCOUNT=LLDDCS1,L,1) COLORYELLOW;
LZGSTAR:=(L压力+L支撑)/2;
LZGEND:=CONST((L压力+L支撑)/2);
LSTARDAY:=IF(LLDDCS2<LLGDCS2,LLDDCS2,LLGDCS2);
L中轨:=DRAWLINE(CURRBARSCOUNT=LSTARDAY,LZGSTAR,ISLASTBAR,LZGEND,1),COLORYELLOW;
MA0:MA(C,0)COLORYELLOW ,LINETHICK1;
M1:=INTPART(3*8/5);
A12:=REF(H,M1)=HHV(H,2*M1+1);
B12:=FILTER(A12,M1);
C12:=BACKSET(B12,M1+1);
D12:=FILTER(C12,M1);{高点}
R112:=BACKSET(ISLASTBAR,BARSLAST(D12)+1);
S112:=R112>REF(R112,1);
DRAWLINE(D12,H,S112,H,1),COLORYELLOW,LINETHICK1,POINTDOT;
M:=INTPART(3*5/5);
AAA:=REF(H,M)=HHV(H,2*M+1);
QYY:=BACKSET(AAA,M+1);
CCC:=FILTER(QYY,M) AND H=HHV(H,M+1);
DDDD:=BARSLAST(CCC),NODRAW;
GDTSS:=IF(CCC,CURRBARSCOUNT,0),NODRAW;
DINGBUTSS:=IF(DDDD,REF(GDTSS,DDDD),GDTSS),NODRAW;
GDCS11:=CONST(DINGBUTSS),NODRAW;
DINGBUTS11:REF(DINGBUTSS,DDDD+1),NODRAW;
GDCS22:=CONST(DINGBUTS11);
高点压力M:DRAWLINE(CURRBARSCOUNT=GDCS22,H,CURRBARSCOUNT=GDCS11,H,1),COLORYELLOW,LINETHICK1;
AA11:=REF(L,M)=LLV(L,2*M+1);
QY11:=BACKSET(AA11,M+1);
CC11:=FILTER(QY11,M) AND L=LLV(L,M+1);
DD11:=BARSLAST(CC11);
DDTSS:=IF(CC11,CURRBARSCOUNT,0);
DDTS11:=IF(DD11,REF(DDTSS,DD11),DDTSS);
DDCS11:=CONST(DDTS11);
DDTS22:=REF(DDTS11,DD11+1);
DDCS22:=CONST(DDTS22);
低点支撑M:DRAWLINE(CURRBARSCOUNT=DDCS22,L,CURRBARSCOUNT=DDCS11,L,1), COLORYELLOW,LINETHICK1;


HIGHN:=10;
LOWN:=10;
HIGHDISPLAY:=0;
LOWDISPLAY:=0;
ZGDISPLAY:=0;
MADISPLAY:=0;
AA01:=REF(H,HIGHN)=HHV(H,2*HIGHN+1);
QY01:=BACKSET(AA01,HIGHN+1);
CC01:=FILTER(QY01,HIGHN) AND H=HHV(H,HIGHN+1);
DDD01:=BARSLAST(CC01);
GDTS01:=IF(CC01,CURRBARSCOUNT,0);
DINGBU01:=IF(DDD01,REF(H,DDD01),H);{顶部}
DINGBUTS01:=IF(DDD01,REF(GDTS01,DDD01),GDTS01);
DINGBU15:=REF(DINGBU01,DDD01+1);
GDCS15:=CONST(DINGBUTS01);
DINGBUTS15:=REF(DINGBUTS01,DDD01+1);
GDCS25:=CONST(DINGBUTS15);
DINGBU25:=REF(DINGBU15,DDD01+1);

高点压力1:DRAWLINE(CURRBARSCOUNT=GDCS25,H,CURRBARSCOUNT=GDCS15,H,1), COLORYELLOW,LINETHICK1;
DRAWLINE(CURRBARSCOUNT=GDCS25,H,ISLASTBAR,REF(H,GDCS25-1),1),COLORYELLOW,LINETHICK1,POINTDOT;
AA001:=REF(L,LOWN)=LLV(L,2*LOWN+1);
QY001:=BACKSET(AA001,LOWN+1);
CC001:=FILTER(QY001,LOWN) AND L=LLV(L,LOWN+1);
DD001:=BARSLAST(CC001);
DDTS00:=IF(CC001,CURRBARSCOUNT,0);
YDB00:=IF(DD001,REF(L,DD001),L);
DDTS001:=IF(DD001,REF(DDTS00,DD001),DDTS00);
DDCS001:=CONST(DDTS001);
ZDB00:=REF(YDB00,DD001+1);
DDTS002:=REF(DDTS001,DD001+1);
DDCS002:=CONST(DDTS002);
低点支撑1:DRAWLINE(CURRBARSCOUNT=DDCS002,L,CURRBARSCOUNT=DDCS001,L,1), COLORYELLOW,LINETHICK1;
ZGSTAR00:=(高点压力1+低点支撑1)/2;
ZGEND00:=CONST((高点压力1+低点支撑1)/2);
STARDAY00:=IF(DDCS002<GDCS25,DDCS002,GDCS25);
DRAWLINE(CURRBARSCOUNT=DDCS002,L,ISLASTBAR,REF(L,DDCS002-1),1),COLORYELLOW,LINETHICK1,POINTDOT;
Z1:=STRCAT(HYBLOCK,' ');
Z2:=STRCAT(Z1,FGBLOCK);
Z3:=STRCAT(Z2,DYBLOCK);
Z4:=STRCAT(Z3,' ');
DRAWTEXT_FIX(ISLASTBAR,0.03,0.99,0,STRCAT(Z4,GNBLOCK)),COLORCYAN;





回复

举报

QQ|

GMT+8, 2024-11-18 00:17

快速回复 返回顶部 返回列表