独股一箭通达信公式 主图 源码附图更新
MA10:=MA(C,10),COLOR009B9B,LINETHICK1;
MA20:=MA(C,20),COLOR009B9B,LINETHICK1;
HX:=MAX(REF(C,1),H);
LX:=MIN(REF(C,1),L);
DRAWBAND(MA10,RGB(231,150,69),MA20,RGB(18,128,144));DRAWKLINE(HX,O,LX,C);
老笔:=0;
G:=MA(C,5);
D:=MA(C,10);
HH:=REF(H,5)=HHV(H,11);
LL:=REF(L,5)=LLV(L,11);
FG01:=BACKSET(HH,6)>BACKSET(HH,5) ;
FD01:=BACKSET(LL,6)>BACKSET(LL,5) ;
FG02:=IF(BARSLAST(FG01)=BARSLAST(FD01) AND G>D,FG01,
IF(BARSLAST(FD01)>BARSLAST(FG01),FG01,0));
FD02:=IF(BARSLAST(FG01)=BARSLAST(FD01) AND D>G,FD01,
IF(BARSLAST(FG01)>BARSLAST(FD01),FD01,0));
FG0:=FG02 AND H=HHV(H,BARSLAST(FD02));
FD0:=FD02 AND L=LLV(L,BARSLAST(FG02));
GP:=IF(FG0,H,DRAWNULL),CIRCLEDOT,COLORCYAN;
DP:=IF(FD0,L,DRAWNULL),CIRCLEDOT,COLORCYAN;
GQ:=L>REF(H,1) AND DAY!=REF(DAY,1);
DQ:=H<REF(L,1) AND DAY!=REF(DAY,1);
GQL:=REF(L,BARSLAST(GQ));
DQH:=REF(H,BARSLAST(DQ));
FGH:=REF(H,BARSLAST(FG0));
FGL:=REF(L,BARSLAST(FG0));
FGH1:=REF(H,BARSLAST(FG0)+1);
FGL1:=REF(L,BARSLAST(FG0)+1);
FGH2:=REF(H,BARSLAST(FG0)+2);
FGL2:=REF(L,BARSLAST(FG0)+2);
FDH:=REF(H,BARSLAST(FD0));
FDL:=REF(L,BARSLAST(FD0));
FDH1:=REF(H,BARSLAST(FD0)+1);
FDL1:=REF(L,BARSLAST(FD0)+1);
FDH2:=REF(H,BARSLAST(FD0)+2);
FDL2:=REF(L,BARSLAST(FD0)+2);
FGZH:=IF(FGL<=FGL1,FGH2,FGH1);
FGZL:=IF(FGH1<FGL,FGL,IF(FGL<=FGL1,FGL2,FGL1));
FDZH:=IF(FDL1>FDH,FDH,IF(FDH>=FDH1,FDH2,FDH1));
FDZL:=IF(FDH>=FDH1,FDL2,FDL1);
FG1:=FGH>FDZH AND FG0;
FD1:=FDL<FGZL AND FD0;{股票指标网}
FG:=FG1 AND FGH>FDH AND FGL>FDL AND FGL1>FDL;
FD:=FD1 AND FDL<FGL AND FDH<FGH AND FDH1<FGH;
BH0:=(H<=REF(H,1) AND L>=REF(L,1)) OR (H>=REF(H,1) AND L<=REF(L,1));
BHG:=COUNT(BH0,BARSLAST(FD0));
BHD:=COUNT(BH0,BARSLAST(FG0));
BGQ:=COUNT(GQ,BARSLAST(FD0));
BDQ:=COUNT(DQ,BARSLAST(FG0));
BK0:=IF(BHG>0,BHG+2+老笔,IF(BHD,BHD+2+老笔,3));
BK:=IF(BGQ,BK0-BGQ,IF(BDQ,BK0-BDQ,BK0));
G1X:=(FG AND BARSLAST(FD)>BK);
D1X:=(FD AND BARSLAST(FG)>BK);
G1:=(FG0 AND REF(H,BARSLAST(FG0))>=REF(H,BARSLAST(G1X)) AND BARSLAST(D1X)>BARSLAST(G1X))
OR (FG1 AND COUNT(GQ,BARSLAST(FD1))>0 AND REF(H,BARSLAST(FG1))>REF(H,BARSLAST(G1X)));
D1:=(FD0 AND REF(L,BARSLAST(FD0))<=REF(L,BARSLAST(D1X)) AND BARSLAST(G1X)>BARSLAST(D1X))
OR (FD1 AND COUNT(DQ,BARSLAST(FG1))>0 AND REF(L,BARSLAST(FD1))<REF(H,BARSLAST(D1X)));
G1H:=IF(BARSLAST(D1)>BARSLAST(G1),REF(H,BARSLAST(G1)),REF(H,BARSLAST(D1))),;
D1L:=IF(BARSLAST(G1)>BARSLAST(D1),REF(L,BARSLAST(D1)),REF(L,BARSLAST(G1)));
G2:=G1 AND H=HHV(G1H,BARSLAST(D1)+1) AND H>REF(H,1) AND BARSLAST(D1)>BARSLAST(G1);
D2:=D1 AND L=LLV(D1L,BARSLAST(G1)+1) AND L<REF(L,1) AND BARSLAST(G1)>BARSLAST(D1);
G3:=G2 OR (FG0 AND REF(H,BARSLAST(FG0))>REF(H,BARSLAST(G2)) AND BARSLAST(D2)>BARSLAST(G2));
D3:=D2 OR (FD0 AND REF(L,BARSLAST(FD0))<REF(L,BARSLAST(D2)) AND BARSLAST(G2)>BARSLAST(D2));
GPB:=IF(G1X,H,DRAWNULL),CIRCLEDOT,COLORYELLOW;
DPB:=IF(D1X,L,DRAWNULL),CIRCLEDOT,COLORYELLOW;
{股票指标网}
{画折线}
NN:=G3;
UU:=D3;
L1:DRAWLINE(NN,H,UU, L,0),COLORDAC272,LINETHICK1;
L2:DRAWLINE(UU,L,NN, H,0),COLOR009393,LINETHICK1;
三一:H-(H-L)*0.333,NODRAW;
二一:H-(H-L)*0.5,NODRAW;
三二:H-(H-L)*0.666,NODRAW;
实体三一:O+(C-O)*0.666,NODRAW;
实体腰线:O+(C-O)*0.5,NODRAW;
{多彩K线-主图公式, 显示大阳\\大阴\\涨停\\跌停\\假阴\\假阳\\跳空\\大K线中点,适用于通达信 }
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;{现价线}
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线画中点线};
未来函数检测结果如下:
该公式包含未来函数:BACKSET
解密、编写股票、期货策略请联系QQ或微信同号:88652583
相关股票指标公式
原理解析:
MA10赋值:C的10日简单移动平均,COLOR009B9B,LINETHICK1
MA20赋值:C的20日简单移动平均,COLOR009B9B,LINETHICK1
HX赋值:1日前的C和H较大值
LX赋值:1日前的C和L的较小值
DRAWBAND(MA10,RGB(231,150,69),MA20,RGB(18,128,144))
DRAWKLINE(HX,O,LX,C)
老笔赋值:0
G赋值:C的5日简单移动平均
D赋值:C的10日简单移动平均
HH赋值:5日前的H=11日内H最高值
LL赋值:5日前的L=11日内L最低值
FG01赋值:BACKSET(HH,6)>BACKSET(HH,5)
FD01赋值:BACKSET(LL,6)>BACKSET(LL,5)
FG02赋值:IF(上次FG01距今天数=BARSLAST(FD01) AND G>D,FG01,
IF(BARSLAST(FD01)>上次FG01距今天数,FG01,0))
FD02赋值:IF(上次FG01距今天数=BARSLAST(FD01) AND D>G,FD01,
IF(上次FG01距今天数>BARSLAST(FD01),FD01,0))
FG0赋值:FG02 AND H=HHV(H,上次FD02距今天数)
FD0赋值:FD02 AND L=LLV(L,上次FG02距今天数)
如果FG0返回H否则返回DRAWNULL
如果FD0返回L否则返回DRAWNULL
GQ:=L>1日前的H AND DAY!=1日前的DAY
DQ:=H<1日前的L AND DAY!=1日前的DAY
GQL:=REF(L,上次GQ距今天数)
DQH:=REF(H,上次DQ距今天数)
FGH赋值:REF(H,上次FG0距今天数)
FGL赋值:REF(L,上次FG0距今天数)
FGH1:=REF(H,上次FG0距今天数+1)
FGL1:=REF(L,上次FG0距今天数+1)
FGH2:=REF(H,上次FG0距今天数+2)
FGL2:=REF(L,上次FG0距今天数+2)
FDH赋值:REF(H,上次FD0距今天数)
FDL赋值:REF(L,上次FD0距今天数)
FDH1:=REF(H,上次FD0距今天数+1)
FDL1:=REF(L,上次FD0距今天数+1)
FDH2:=REF(H,上次FD0距今天数+2)
FDL2:=REF(L,上次FD0距今天数+2)
如果FGL<=FGL1返回FGH2否则返回FGH1
FGZL赋值:IF(FGH1
FDZH赋值:IF(FDL1>FDH,FDH,IF(FDH>=FDH1,FDH2,FDH1))
如果FDH>=FDH1返回FDL2否则返回FDL1
FG1赋值:FGH>FDZH AND FG0
FD1赋值:FDL{股票指标网}
FG赋值:FG1 AND FGH>FDH AND FGL>FDL AND FGL1>FDL
FD赋值:FD1 AND FDL
BH0赋值:(H<=1日前的H AND L>=1日前的L) OR (H>=1日前的H AND L<=1日前的L)
BHG赋值:COUNT(BH0,上次FD0距今天数)
BHD赋值:COUNT(BH0,上次FG0距今天数)
BGQ赋值:COUNT(GQ,上次FD0距今天数)
BDQ赋值:COUNT(DQ,上次FG0距今天数)
BK0赋值:IF(BHG>0,BHG+2+老笔,IF(BHD,BHD+2+老笔,3))
BK赋值:IF(BGQ,BK0-BGQ,IF(BDQ,BK0-BDQ,BK0))
G1X:=(FG AND 上次FD距今天数>BK)
D1X:=(FD AND 上次FG距今天数>BK)
G1:=(FG0 AND REF(H,上次FG0距今天数)>=REF(H,BARSLAST(G1X)) AND BARSLAST(D1X)>BARSLAST(G1X))
OR (FG1 AND COUNT(GQ,BARSLAST(FD1))>0 AND REF(H,BARSLAST(FG1))>REF(H,BARSLAST(G1X)))
D1:=(FD0 AND REF(L,上次FD0距今天数)<=REF(L,BARSLAST(D1X)) AND BARSLAST(G1X)>BARSLAST(D1X))
OR (FD1 AND COUNT(DQ,BARSLAST(FG1))>0 AND REF(L,BARSLAST(FD1))
G1H:=IF(上次D1距今天数>BARSLAST(G1),REF(H,BARSLAST(G1)),REF(H,上次D1距今天数)),
D1L:=IF(上次G1距今天数>BARSLAST(D1),REF(L,BARSLAST(D1)),REF(L,上次G1距今天数))
G2:=G1 AND H=HHV(G1H,上次D1距今天数+1) AND H>1日前的H AND 上次D1距今天数>BARSLAST(G1)
D2:=D1 AND L=LLV(D1L,上次G1距今天数+1) AND L<1日前的L AND 上次G1距今天数>BARSLAST(D1)
G3:=G2 OR (FG0 AND REF(H,上次FG0距今天数)>REF(H,BARSLAST(G2)) AND BARSLAST(D2)>BARSLAST(G2))
D3:=D2 OR (FD0 AND REF(L,上次FD0距今天数)[BARSLAST(D2))]
如果G1X返回H否则返回DRAWNULL
如果D1X返回L否则返回DRAWNULL
{股票指标网}
{画折线}
NN赋值:G3
UU赋值:D3
输出
L1:DRAWLINE(NN,H,UU, L,0),COLORDAC272,LINETHICK1
输出
L2:DRAWLINE(UU,L,NN, H,0),COLOR009393,LINETHICK1
输出
三一:H-(H-L)*0.333,NODRAW
输出
二一:H-(H-L)*0.5,NODRAW
输出
三二:H-(H-L)*0.666,NODRAW
输出
实体三一:O+(C-O)*0.666,NODRAW
输出
实体腰线:O+(C-O)*0.5,NODRAW
当满足条件ISLASTBAR时,在横轴0纵轴0位置书写文字
当满足条件ISLASTBAR时,在横轴0.05纵轴0位置书写文字
当满足条件ISLASTBAR时,在横轴0.1纵轴0位置书写文字
{在屏幕左上角显示所属概念板块}
{跳空}
{STICKLINE(1日前的L>H,H,1日前的L,5,0),COLORGRAY
STICKLINE(1日前的H输出}
C_: CONST(C),COLORLIRED,POINTDOT
{现价线}
MA5赋值:C的5日简单移动平均
输出{股票指标网}
MA5角度: ATAN((MA5/1日前的MA5-1)*100)*180/3.1416,NODRAW
DRAWKLINE(H,O,L,C)
{重绘K线}
RC1赋值:1日前的C
如果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')
如果ST返回 C>=C涨停5否则返回 C>=C涨停10
如果ST返回 C<=C跌停5否则返回 C<=C跌停10
如果ST返回 H>=C涨停5否则返回 H>=C涨停10
如果ST返回 L<=C跌停5否则返回 L<=C跌停10
STICKLINE(盘中涨停,H,C和O较大值,0,0),画洋红色
{涨停后回落}
STICKLINE(盘中跌停,L,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)
当满足条件大阳线时,在O和C之间画柱状线
大阴线赋值:C1000 AND C当满足条件大阴线时,在O和C之间画柱状线
当满足条件涨停时,在O和C之间画柱状线
当满足条件跌停时,在O和C之间画柱状线
假阴赋值:C1日前的C
当满足条件假阴时,在O和C之间画柱状线
{假阴柱}
假阳赋值:C>O AND C<1日前的C
当满足条件假阳时,在O和C之间画柱状线
{假阳柱}
大盘TJ赋值:PERIOD=5 AND NAMELIKE('上证指数')
AND ((C-1日前的C的绝对值)/1日前的C>=0.025 OR ABS(C-O)>=60)
STICKLINE(大盘TJ,(H+L)/2,(H+L)/2,2,0),画黄色
{显示大盘日线的60点大K线中值}
STICKLINE((大阳线 OR 大阴线 OR 涨停 OR 跌停)
AND BETWEEN(C,1,500),L+(H-L)/2,L+(H-L)/2,1,0),画黄色
{大K线画中点线}