这个问题要参考绘图函数DRAWLINE的应用,举例如下:
DRAWLINE 绘制直线段
在图形上绘制直线段。
用法:DRAWLINE(COND1,PRICE1,COND2,PRICE2,EXPAND)
当COND1条件满足时,在PRICE1位置画直线条件满足时,在PRICE2位置画直线终点,EXPAND为延长类型。
例如:DRAWLINE(HIGH>=HHV(HIGH,20),HIGH,LOW<=LLV(LOW,20),LOW,1)表示在创20天新高与创20天新低之间画直线并且向右延长。
由于你提供的信息有限,只能回答到这一步了,仅供参考。 通达信中主图上怎么把高点低点 也就是颈线 怎么用公式自动画出来 谢谢 求公式
VAR100:=(100 - ((90 * (HHV(HIGH,20) - CLOSE)) / (HHV(HIGH,20) - LLV(LOW,20))));
VAR200:=(100 - ((90 * (HHV(HIGH,20) - CLOSE)) / (HHV(HIGH,20) - LLV(LOW,20))));
VAR300:=(100 - MA(((100 * (HHV(HIGH,5) - CLOSE)) / (HHV(HIGH,5) - LLV(LOW,5))),34));
F:IF(CROSS(VAR200,MA(VAR300,5)),LOW * 0.98,DRAWNULL),CROSSDOT,LINETHICK3,COLOREE00EE;
年:MA(CLOSE,22),LINETHICK2,COLORWHITE;
日:=150;昨前:=3;
高1:=REF(HHV(H,日),昨前);
低1:=REF(LLV(L,日),昨前);
H1:=高1-(高1-低1)*0.191;
H2:=高1-(高1-低1)*0.382;
H3:=高1-(高1-低1)*0.5;
H4:=高1-(高1-低1)*0.618;
H5:=高1-(高1-低1)*0.809;
顶:REFDATE(高1,DATE),COLORRED;
一0.809:REFDATE(H1,DATE),COLORYELLOW;
二0.618:REFDATE(H2,DATE),COLORMAGENTA;
三0.500:REFDATE(H3,DATE),COLORWHITE;
四0.382:REFDATE(H4,DATE),COLORGREEN;
五0.191:REFDATE(H5,DATE),COLORYELLOW;
低:REFDATE(低1,DATE),COLORRED;
VAR31:=HHVBARS(ZIG(3, 19)>REF(ZIG(3,19),1)
AND REF(ZIG(3,19), 1)<REF(ZIG(3,19), 2),0);
STICKLINE(VAR31=2,L*0.95,L*0.98,8,0),COLOR0000FF;
DRAWTEXT(VAR31=2,L*0.95,3天),COLORYELLOW;
STICKLINE(VAR31=4,H*1.05,H*1.02,8,0),COLOR9966FF;
DRAWTEXT(VAR31=4,H*1.06,5天),COLORYELLOW;
STICKLINE(VAR31=7,L*0.95,L*0.98,8,0),COLOR00FFFF;
DRAWTEXT(VAR31=7,L*0.95,8天),COLORYELLOW;
STICKLINE(VAR31=12,H*1.05,H*1.02,8,0),COLORFF33FF;
DRAWTEXT(VAR31=12,H*1.06,13天),COLORYELLOW;
STICKLINE(VAR31=20,L*0.95,L*0.98,8,0),COLOR0066FF;
DRAWTEXT(VAR31=20,L*0.95,21天),COLORYELLOW;
STICKLINE(VAR31=33,H*1.05,H*1.02,8,0),COLORFFFF00;
DRAWTEXT(VAR31=33,H*1.06,34天),COLORYELLOW;
STICKLINE(VAR31=54,L*0.95,L*0.98,8,0),COLOR006600;
DRAWTEXT(VAR31=54,L*0.95,55天),COLORYELLOW;
STICKLINE(VAR31=88,H*1.05,H*1.02,8,0),COLOR00FF00;
DRAWTEXT(VAR31=88,H*1.06,89天),COLORYELLOW;
STICKLINE(VAR31=143,L*0.95,L*0.98,8,0),COLORCCFFFF;
DRAWTEXT(VAR31=143,L*0.95,144天),COLORYELLOW;
STICKLINE(VAR31=232 ,H*1.05,H*1.02,8,0),COLORFF0033;
DRAWTEXT(VAR31=232,H*1.06,233天),COLORYELLOW;
STICKLINE(VAR31=376,L*0.95,L*0.98,8,0),COLORFF9966;
DRAWTEXT(VAR31=376,L*0.95,377天),COLORYELLOW;
这是黄金分割的主图
自动画线太多了,给你一个我看好的,源码下面网址里有图片演示.
该指标能够做到对前期高点和最近高点的连线、前期低点和最近低点的连线、阻力位和支撑位的平行直线的连线,可以说简单易懂,一目了然。这类指标要用到未来函数,通常不做为买卖信号的参考。但该指标在一定周期内根据K线的走势所画的线已经成立,因此股价突破前高或颈线的点位还是比较可靠的,大家不妨在实战中来验证。所以,除了主图以外,还编制了选股指标。
指标中的实线为高、低点连线,虚线为阻力位和支撑位。
该指标可以复制粘贴到任何主图里。
MA7:MA(C,7),COLORWHITE;
MA14:MA(C,14),COLORYELLOW;
MA25:MA(C,25),COLORFF00FF;
MA120:MA(C,120),COLORFFCC66;
QA:=REF(H,10)=HHV(H,2*10+1);
QB:=BACKSET(QA,10+1);
QC:=FILTER(QB,10) AND H=HHV(H,10+1);
QD:=BARSLAST(QC);
QE:=IF(QC,CURRBARSCOUNT,0);
QF:=IF(QD,REF(QE,QD),QE);
QG:=CONST(QF);
QH:=REF(QF,QD+1);
QW:=CONST(QH);
DRAWLINE(CURRBARSCOUNT=QW,H,CURRBARSCOUNT=QG,H,1),COLORGREEN;
DRAWLINE(CURRBARSCOUNT=QW,H,ISLASTBAR,REF(H,QW-1),1),COLOR0099FF,POINTDOT;
DRAWLINE(CURRBARSCOUNT=QG,H,ISLASTBAR,REF(H,QG-1),1),COLOR0099FF,POINTDOT;
QM:=INTPART(3*8/5);
QR:=REF(H,QM)=HHV(H,2*QM+1);
QT:=FILTER(QR,QM);
QY:=BACKSET(QT,QM+1);
QU:=FILTER(QY,QM);
QI:=BACKSET(ISLASTBAR,BARSLAST(QU)+1);
QP:=QI>REF(QI,1);
DRAWLINE(QU,H,QP,H,1),COLORRED;
QA1:=REF(L,8)=LLV(L,2*8+1);
QB1:=BACKSET(QA1,8+1);
QC1:=FILTER(QB1,8) AND L=LLV(L,8+1);
QD1:=BARSLAST(QC1);
QE1:=IF(QC1,CURRBARSCOUNT,0);
QF1:=IF(QD1,REF(L,QD1),L);
QG1:=IF(QD1,REF(QE1,QD1),QE1);
QH1:=CONST(QG1);
QW1:=REF(QF1,QD1+1);
QM1:=REF(QG1,QD1+1);
QR1:=CONST(QM1);
DRAWLINE(CURRBARSCOUNT=QR1,L,CURRBARSCOUNT=QH1,L,1),COLORBLUE;
DRAWLINE(CURRBARSCOUNT=QH1,L,ISLASTBAR,REF(L,QH1-1),1),COLORWHITE,POINTDOT;
DRAWLINE(CURRBARSCOUNT=QR1,L,ISLASTBAR,REF(L,QR1-1),1),COLORWHITE,POINTDOT;
QT1:=REF(L,QM)=LLV(L,2*QM+1);
QY1:=FILTER(QT1,QM);
QU1:=BACKSET(QY1,QM+1);
QI1:=FILTER(QU1,QM);
QP1:=BACKSET(ISLASTBAR,BARSLAST(QI1)+1);
QJ1:=QP1>REF(QP1,1);
DRAWLINE(QI1,L,QJ1,L,1),COLORRED;
SR1:=REF(HIGH,10)=HHV(HIGH,2*10+1);
SR2:=FILTER(SR1,10);
SR3:=BACKSET(SR2,10+1);
HD:=FILTER(SR3,10);
前高:=REF(H,BARSLAST(HD));
DRAWICON(CROSS(C,前高),L-0.20,3);{突破前高的信号} 请高手帮我做个主图的自动划线公式,很简单的,先谢谢了!
KX:DRAWKLINE(H,O,L,C);
ZG:IF(HHV(H,60),CONST(HHV(H,60)),DRAWNULL),COLORWHITE;
ZD:IF(LLV(L,60),CONST(LLV(L,60)),DRAWNULL),COLORGREEN;
看看附图是否满足你的要求(线性及颜色),如果满意并且需要请回复,我将以加密方式发送(最低点向上百分比可以通过Alt+T调整参数)。
求助:通达信,股价斜下高点连线自动画线公式,先谢了哟!
将以下公式中的N换成5来用,你没说具体的高点指什么高点,只好给你这个了。
A1:=REF(H,N)=HHV(H,2*N+1);
B1:=FILTER(A1,N);
C1:=BACKSET(B1,N+1);
D1:=FILTER(C1,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;
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);
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);
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);
短期压力:DRAWLINE(S2,H,S1,H,1),LINETHICK2,COLORRED;
短期支撑:DRAWLINE(U2,L,U1,L,1),LINETHICK2,COLORGREEN;