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

 找回密码
 注册昵称

QQ登录

只需一步,快速开始

搜索
上一主题 下一主题

[通达信] 通达信王子操盘线源码副图


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

以下是通达信王子操盘线源码副图

DRAWGBK(C>0, RGB(40,120,20),RGB(00,00,00),0,0,1),LINETHICK2;
{黄金率坐标系----用低\高位价*黄金分割率}
周期:=30; {设为参数1: N(30,480,240),是可见的周期数,自己调}
开关:=4; {设为参数2: M(1,4,4),自己调,缺省4(都显示)}
{1只显示以低点为基准的分割点, 2只显示以高点为基准的分割点,
3只显示以高低差为基准的分割点,4同时显示以上三种情况,时间坐标始终都显示 }
均价:AMOUNT/VOL/100,NODRAW;
假阴1:=O>C AND 均价>REF(C,1);
DRAWTEXT(假阴1,L-0.2,'↖假阴'1),COLORMAGENTA;
STICKLINE(假阴1,O,C,1,0),COLORRED;
DRAWICON(C<O AND C>REF(C,1),H,6),LINETHICK2;
STICKLINE(C<O AND C>REF(C,1),H,L,0,0)COLORMAGENTA,LINETHICK2;
STICKLINE(C<O AND C>REF(C,1),O,C,3,0)COLORMAGENTA,LINETHICK2;
DRAWTEXT_FIX(ISLASTBAR,0,2,0,HYBLOCK);{在屏幕左上角显示所属行业板块}
DRAWTEXT_FIX(ISLASTBAR,0.31,0,0,DYBLOCK);{在屏幕左上角显示所属地域板块}
DRAWTEXT_FIX(ISLASTBAR,0.38,0,0,GNBLOCK);{在屏幕左上角显示所属概念板块}
{跳空}
STICKLINE(REF(L,1)>H,H,REF(L,1),5,0),COLORGRAY;
STICKLINE(REF(H,1)<L,L,REF(H,1),5,0),COLORGRAY;
现价线: CONST(C),COLORLIRED,POINTDOT,LINETHICK2;{现价线}
高1:=CONST(HHV(H,周期)); 低1:=CONST(LLV(L,周期)); H_L:=高1-低1;{阶段高低差}
顶: 高1,COLORRED,POINTDOT;
底: 低1,COLORGREEN,POINTDOT;

{王子操盘线}
MA6: MA(C,6),COLORGREEN,LINETHICK2;
MA6_: IF(MA6>=REF(MA6,1),MA6,DRAWNULL),COLORLIGRAY,LINETHICK2;

{==========时间坐标====以阶段低点为基准=====白字======}
LTJ:= L=低1;
LSJ:=BARSLAST(LTJ)+1;
L00:=低1+H_L*0.01;
DRAWTEXT(LSJ=5,L00,'5');
DRAWTEXT(LSJ=8,L00,'8');
DRAWTEXT(LSJ=13,L00,'13');
DRAWTEXT(LSJ=21,L00,'21');
DRAWTEXT(LSJ=34,L00,'34');
DRAWTEXT(LSJ=55,L00,'55');
DRAWTEXT(LSJ=89,L00,'89');
DRAWTEXT(LSJ=144,L00,'144');
DRAWTEXT(LSJ=233,L00,'233');
N01:=10;
T01:=CONST(HHVBARS(V,10)),COLOR0000FF,LINETHICK1;
量能平台:IF(CURRBARSCOUNT<=N01+15,CONST(IF(T01=0,C,REF(C,T01))),DRAWNULL)
,COLORLIBLUE,LINETHICK4;

DRAWTEXT(ISLASTBAR,量能平台,' 量能平台'),COLOR00F0F0;
HV:=HHV(V,5)=V OR V/REF(V,1)>=5;
FT:=BARSLAST(HV);
量能平台1:=IF(HV,C,REF(C,FT));
DRAWTEXT(量能平台1>REF(量能平台1,1)AND C<REF(C,1),L,'*跌'),COLORGREEN;
DRAWTEXT(量能平台1<REF(量能平台1,1) AND C>REF(C,1),L,'*买'),COLORYELLOW;
DRAWTEXT(量能平台1>REF(量能平台1,1) AND C>REF(C,1) AND C>MA(C,13) AND C=HHV(C,20) AND C/REF(C,1)>1.05,L,'*买'),COLORFFFFFF;
N:=3;{原码 P1:=3;}
A1:=REF(H,N)=HHV(H,2*N+1);
B1:=FILTER(A1,N);
C18:=BACKSET(B1,N+1);
D1:=FILTER(C18,N);{高点}
A2:=REF(L,N)=LLV(L,2*N+1);
B2:=FILTER(A2,N);
C2:=BACKSET(B2,N+1);
D2:=FILTER(C2,N);{低点}
E1:=(REF(LLV(L,2*N),1)+REF(HHV(H,2*N),1))/2;
E2:=(H+L)/2;{高低点出现在同一K线上时可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR ISLASTBAR OR BARSCOUNT(C)=1;
L1:=(D2 AND NOT(D1 AND E1<E2));
H2:=D1 AND NOT(D2 AND E1>=E2);X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,L,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2);
LD:=I1>REF(I1,1),LINETHICK0;{过滤后低点}
L2:=LD OR ISLASTBAR OR BARSCOUNT(C)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,H,0),X2));
G2:=F2>REF(F2,1);
I2:=BACKSET(G2,2);
HD:=I2>REF(I2,1),LINETHICK0;{过滤后高点}
R1:=BACKSET(ISLASTBAR,BARSLAST(HD)+1);
S1:=R1>REF(R1,1); {前一高}
T1:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);
U1:=T1>REF(T1,1); {前一低}
R2:=BACKSET(S1,REF(BARSLAST(HD),1)+2);
S2:=R2>REF(R2,1); {前二高}
T2:=BACKSET(U1,REF(BARSLAST(LD),1)+2);
U2:=T2>REF(T2,1); {前二低}
T3:=BACKSET(U2,REF(BARSLAST(LD),1)+2);
U3:=T3>REF(T3,1); {前三低}
T4:=BACKSET(U3,REF(BARSLAST(LD),1)+2);
U4:=T4>REF(T4,1); {前四低}
R3:=BACKSET(S2,REF(BARSLAST(HD),1)+2);
S3:=R3>REF(R3,1); {前三高}
R4:=BACKSET(S3,REF(BARSLAST(HD),1)+2);
S4:=R4>REF(R4,1); {前四高}
★压力1:DRAWLINE(S2,H,S1,H,1),COLORYELLOW,LINETHICK3;

★压力2:DRAWLINE(S3,H,S2,H,1),COLORFF8000,LINETHICK3;

★压力3:DRAWLINE(S4,H,S3,H,1),COLOR0000FF,LINETHICK2;
★支撑3:DRAWLINE(U4,L,U3,L,1),COLOR0000FF,LINETHICK2;
日A1:=YEAR=2012 AND MONTH=12 AND DAY=07 AND C>1000;
日B1:=YEAR=2013 AND MONTH=01 AND DAY=25 AND C>1000;
X1207: DRAWLINE(日A1,C,日B1,L,1),COLORLIGREEN;
年:=YEAR=2011; 月:= MONTH=6;
日0624:=年 AND 月 AND DAY=24;
日0627:=年 AND 月 AND DAY=27;
日0628:=年 AND 月 AND DAY=28;
日0629:=年 AND 月 AND DAY=29;
G: DRAWLINE(日0624,C,日0627,C,1),COLORMAGENTA;{灯塔线G};
A: DRAWLINE(日0624,C,日0628,O,1),COLORLIRED;{灯塔线A};
B: DRAWLINE(日0624,C,日0629,O,1),COLORYELLOW;{灯塔线B};
C1: DRAWLINE(日0624,C,日0627,L,1),COLORGREEN;{灯塔线C};
D: DRAWLINE(日0624,C,日0629,C,1),COLORLICYAN;{灯塔线D};
DRAWTEXT(ISLASTBAR,G,'G'),COLORMAGENTA;
DRAWTEXT(ISLASTBAR,A,'A'),COLORLIRED;
DRAWTEXT(ISLASTBAR,B,'B'),COLORYELLOW;
DRAWTEXT(ISLASTBAR,C1,'C1'),COLORGREEN;
DRAWTEXT(ISLASTBAR,D,'D'),COLORLICYAN;

DRAWTEXT_FIX(ISLASTBAR,0,0,0,HYBLOCK);{在屏幕左上角显示所属行业板块}
DRAWTEXT_FIX(ISLASTBAR,0.05,0,0,DYBLOCK);{在屏幕左上角显示所属地域板块}
DRAWTEXT_FIX(ISLASTBAR,0.1,0,0,GNBLOCK);{在屏幕左上角显示所属概念板块}
{跳空}
STICKLINE(REF(L,1)>H,H,REF(L,1),5,0),COLORGRAY;
STICKLINE(REF(H,1)<L,L,REF(H,1),5,0),COLORGRAY;
C_现价线: CONST(C),COLORLIRED,POINTDOT,LINETHICK2;{现价线}
MA5:=MA(C,5);
MA5角度: ATAN((MA5/REF(MA5,1)-1)*100)*180/3.1416,NODRAW;
{========================================================}
DRAWKLINE(H,O,L,C);{重绘K线}
RC1:=REF(C,1);
CS:=IF(C>=1,10000,100000);
C涨停10:=1.10*RC1-49/CS;{考虑到4舍5入}
C涨停5 :=1.05*RC1-49/CS;
C跌停10:=0.90*RC1+51/CS;
C跌停5 :=0.95*RC1+51/CS;
ST:=NAMELIKE('S') OR NAMELIKE('*S');
涨停:= IF(ST, C>=C涨停5, C>=C涨停10);
跌停:= IF(ST, C<=C跌停5, C<=C跌停10);
盘中涨停:=IF(ST, H>=C涨停5, H>=C涨停10);
盘中跌停:=IF(ST, L<=C跌停5, L<=C跌停10);
STICKLINE(盘中涨停,H,MAX(C,O),0,0),COLORMAGENTA;{涨停后回落}
STICKLINE(盘中跌停,L,MIN(C,O),0,0),COLORLICYAN;{跌停后回升}
大阳线:=C>O AND (C>=C涨停5 OR C>(1.05*O-51/CS) ) OR (C>1000 AND C>RC1*1.024);
STICKLINE(大阳线,O,C,1,0),COLOR0000BB;
大阴线:=C<O AND (C<=C跌停5 OR C<(0.95*O+49/CS) ) OR (C>1000 AND C<RC1*0.976);
STICKLINE(大阴线,O,C,1,0),COLORLIGREEN;
STICKLINE(涨停,O,C,1,0),COLORMAGENTA;
STICKLINE(跌停,O,C,1,0),COLORLICYAN;
假阴:=C<O AND C>REF(C,1);
STICKLINE(假阴,O,C,0,0),COLORRED;{假阴柱};
假阳:=C>O AND C<REF(C,1);
STICKLINE(假阳,O,C,0,0),COLORGREEN;{假阳柱};
大盘TJ:=PERIOD=5 AND NAMELIKE('上证指数')
AND (ABS((C-REF(C,1)))/REF(C,1)>=0.025 OR ABS(C-O)>=60);
STICKLINE(大盘TJ,(H+L)/2,(H+L)/2,2,0),COLORYELLOW;{显示大盘日线的60点大K线中值};
STICKLINE((大阳线 OR 大阴线 OR 涨停 OR 跌停)
AND BETWEEN(C,1,500),L+(H-L)/2,L+(H-L)/2,1,0),COLORYELLOW;{大K线画中点线};
HTJ:= H=高1;
HSJ:=BARSLAST(HTJ)+1;
H00:=高1+H_L*0.01;
DRAWTEXT(HSJ=5,H00,'5');
DRAWTEXT(HSJ=8,H00,'8');
DRAWTEXT(HSJ=13,H00,'13');
DRAWTEXT(HSJ=21,H00,'21');
DRAWTEXT(HSJ=34,H00,'34');
DRAWTEXT(HSJ=55,H00,'55');
DRAWTEXT(HSJ=89,H00,'89');
DRAWTEXT(HSJ=144,H00,'144');
DRAWTEXT(HSJ=233,H00,'233');
真阴线:=C<=REF(C,1) AND C<=O;
假阳线:=C<=REF(C,1) AND C>=O;
阴线:=真阴线>0 OR 假阳线>0;
阴线天数:=BARSLAST(阴线);
阴线实体最高价:=MAX(REF(C,阴线天数),REF(O,阴线天数));
阴线成交量:=REF(V,阴线天数);
阳胜条件:=阴线天数>0 AND C>=阴线实体最高价 AND V>=阴线成交量;
阳胜:=IF(阳胜条件>0 AND REF(阳胜条件,1)=0,10,0);
真阳线:=C>=REF(C,1) AND C>=O;
假阴线:=C>=REF(C,1) AND C<=O;
阳线:=真阳线>0 OR 假阴线>0;
阳线天数:=BARSLAST(阳线);
阳线实体最低价:=MIN(REF(C,阳线天数),REF(O,阳线天数));
阳线成交量:=REF(V,阳线天数);
阴胜条件:=阳线天数>0 AND C<=阳线实体最低价 AND V>=阳线成交量*0.9;
阴胜:=IF(阴胜条件>0 AND REF(阴胜条件,1)=0,10,0),COLORWHITE;
阳胜进:=IF(阳胜>0,20,0),COLORRED;
阴胜出:=IF(阴胜>0,20,0);
DRAWTEXT(阳胜进>0,LOW*0.99,'进'),COLORRED,LINETHICK3;
MA250:MA(CLOSE,250),COLORWHITE,LINETHICK2;
MA72:MA(CLOSE,72),COLOR3375FF,LINETHICK2;
{参数N1、N2、N3、N4:取值1-300;推荐5、10、24、72};
DRAWICON(CROSS(MA6,MA72),MA6,11);
顶底开关:=0;
点位差:=0;
指定点:=0;
V2V:=V/REF(V,1)>=1.9 AND C>REF(C,1);
STICKLINE(V2V,H,L,0,0),COLORYELLOW;
STICKLINE(V2V,O,C,3.1,0),COLOR0033FF;
STICKLINE(V2V,O,C,2.1,0),COLOR0077FF;
STICKLINE(V2V,O,C,1.1,0),COLOR00BBFF;
STICKLINE(V2V,O,C,0.1,0),COLOR00FFFF;
ZT:=C/REF(C,1)>1.097;
ZT数:COUNT(ZT,BARSSINCE(ZT)),NODRAW;
均价1:=AMO/VOL/100;
假阴真阳:=C<O AND C>=REF(MIN(C,O),1) AND 均价>REF(均价,1);
DT:=假阴真阳;
STICKLINE(DT,H,L,0,0),COLORFFAA00;
STICKLINE(DT,O,C,3,0),COLORFF3300;
STICKLINE(DT,O,C,2,0),COLORFF7700;
STICKLINE(DT,O,C,1,0),COLORFFAA00;
STICKLINE(DT,O,C,0.1,0),COLORFFFF00;
YX:=REF(O,BARSLAST(假阴真阳));
假阴实顶:YX,COLORFF7700,NODRAW;
STICKLINE(V,YX,YX,1,0),COLORFF7700;
L0:=点位差/100;
前极点精准线:IF(顶底开关=0,CONST(REF(L,指定点)),CONST(REF(H,指定点))),COLOR178448,LINETHICK3;
DRAWICON(ABS(L-前极点精准线)<=L0,前极点精准线*0.99,38),LINETHICK3;
DRAWICON(ABS(H-前极点精准线)<=L0,前极点精准线*1.01,39),LINETHICK3;
{H极点精准线:CONST(REF(H,指定点)),COLOR7777FF;
DRAWICON(ABS(H极点精准线-H)<=L0,H极点精准线*1.01,35);
DRAWICON(ABS(H极点精准线-L)<=L0,H极点精准线*0.99,34);}
{极点精准线:CONST(L),COLOR0077FF;
DRAWICON(ABS(L-极点精准线)<=L0,极点精准线*0.99,1);
DRAWICON(ABS(H-极点精准线)<=L0,极点精准线*1.01,2);
同向极点精准数:COUNT(ABS(L-极点精准线)<=L0,60)-1,COLOR0077FF,NODRAW;
异向极点精准数:COUNT(ABS(H-极点精准线)<=L0,60),COLOR0077FF,NODRAW;
XG:=同向极点精准数>0 AND 异向极点精准数>0;}
{DIFF:=10*(EMA(CLOSE,12)-EMA(CLOSE,26));
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
量缩价涨:=C<REF(O,1) AND V<REF(V,1) AND MACD>REF(MACD,1) AND C>REF(C,1) AND REF(C<O,1) AND C>O;
阴KDAY:=BARSLAST(量缩价涨)+1;
STICKLINE(V,REF(O,阴KDAY),REF(O,阴KDAY),3.5,0),COLORMAGENTA;
DRAWICON(CROSS(C,REF(O,阴KDAY)),L,1);}
N1:=150;判断高低:=3;
高:=REF(HHV(H,N1),判断高低);
近期顶:REFDATE(高,DATE),COLORGREEN,LINETHICK3;
低:=REF(LLV(L,N1),判断高低);
近期底:REFDATE(低,DATE),COLORRED,LINETHICK3;
涨跌:=REF(C,1);
涨停1:=IF((C-涨跌)*100/涨跌>=(10-0.01*100/涨跌),1,0);
DRAWICON(涨停1,H*0.97,23);
LAST3K:=CURRBARSCOUNT>4;





回复

举报

QQ|

GMT+8, 2024-11-18 08:48

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