关于drawline函数的用法

 一、DRAWLINE函数说明

1、功能:图形上绘制直线段.

2、用法: DRAWLINE(COND1,PRICE1,COND2,PRICE2,EXPAND),当COND1条件满足时,在PRICE1位置画直线起点,当COND2条件满足时,在PRICE2位置画直线终点,EXPAND为延长类型。只有COND1和COND2均成立后才画出线段。

3、例:ABC:=DRAWLINE(HIGH>=HHV(HIGH,20),HIGH,LOW<=LLV(LOW,20),LOW,1)表示在创20天新高与创20天新低之间画直线并且向右延长。在COND2未成立时,赋值是空的,但是如果后面COND2成立了,ABC就被赋值了。

4、说明:从历史信息上看,DRAWLINE函数提供的信号十分准确,但与未来函数一样,信号的出现需要后市信息的确定才可以确定,所以慎待DRAWLINE函数!!

二、含有DRAWLINE函数的指标

指标1

N1:=7;

LC:=REF(CLOSE,1);

X:=SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*100,COLORYELLOW,LINETHICK1;

魔鬼:=DRAWLINE(X>=HHV(X,N1),X,X<=LLV(X,N1),X,1),COLOR00FF00;

魔王:=DRAWLINE(X>=HHV(X,N1),X,X<=LLV(X,N1),1,X),COLOR00FF00;

TJ0:=X=魔王;

TJ1:=X=魔鬼;

TJ2:=X<REF(X,1);

TJ3:=X>REF(1,X);

JRS1:=DRAWICON(TJ1 AND TJ2,X,1);

JRS2:=DRAWICON(TJ0 AND TJ3,X,2);

DRAWICON(FILTER(JRS1>0,1),L*0.97,1);

DRAWICON(FILTER(JRS2>0,1),H*1.02,15);

指标2

MA5:=EMA(C,5);

MA13:=EMA(C,13);

UP:=DRAWLINE(L=LLV(L,BARSLAST(CROSS(MA13,MA5))+1),LLV(L,BARSLAST(CROSS(MA13,MA5))+1),H=HHV(H,BARSLAST(CROSS(MA5,MA13))+1),HHV(H,BARSLAST(CROSS(MA5,MA13))+1),0),COLOR0000FF;

DOWN:=DRAWLINE(H=HHV(H,BARSLAST(CROSS(MA5,MA13))+1),HHV(H,BARSLAST(CROSS(MA5,MA13))+1),L=LLV(L,BARSLAST(CROSS(MA13,MA5))+1),LLV(L,BARSLAST(CROSS(MA13,MA5))+1),0),COLOR00FF00;

A8:=100*EMA(EMA((C-REF(C,1)),6),6)/EMA(EMA(ABS((C-REF(C,1))),6),6);

UP1:=DRAWLINE(L=LLV(L,BARSLAST(CROSS(EMA(CLOSE,19),EMA(CLOSE,7)))+1),LLV(L,BARSLAST(CROSS(EMA(CLOSE,19),EMA(CLOSE,7)))+1),H=HHV(H,BARSLAST(CROSS(EMA(CLOSE,7),EMA(CLOSE,19)))+1),HHV(H,BARSLAST(CROSS(EMA(CLOSE,7),EMA(CLOSE,19)))+1),0);

DOWN1:=DRAWLINE(H=HHV(H,BARSLAST(CROSS(EMA(CLOSE,7),EMA(CLOSE,19)))+1),HHV(H,BARSLAST(CROSS(EMA(CLOSE,7),EMA(CLOSE,19)))+1),L=LLV(L,BARSLAST(CROSS(EMA(CLOSE,19),EMA(CLOSE,7)))+1),LLV(L,BARSLAST(CROSS(EMA(CLOSE,19),EMA(CLOSE,7)))+1),0);

买:=IF((LLV(A8,2)=LLV(A8,7) AND COUNT(A8<0,2) AND CROSS(A8,MA(A8,2))) AND REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1),DRAWNULL,100);

卖:=IF(DOWN = UP AND DOWN<REF(UP,1) AND CROSS(MA(A8,2),A8), DRAWNULL,100);

DRAWTEXT(买=100,L,'买'),COLOR00FF00;

DRAWTEXT(卖=100,H,'卖'),COLOR00FF00;

指标3

N1:=5;N2:=10;

STICKLINE(C>0,0,10,15,0),COLOR781816;

LC:=REF(CLOSE,1);

RSI5:SMA(MAX(CLOSE-LC,0),N1,1)/SMA(ABS(CLOSE-LC),N1,1)*10,COLORFF00FF,LINETHICK1;

RSI10:SMA(MAX(CLOSE-LC,0),N2,1)/SMA(ABS(CLOSE-LC),N2,1)*10,COLOR00FFFF;

VAR1:=C-REF(C,1);

VAR2:=100*EMA(EMA(VAR1,6),6)/EMA(EMA(ABS(VAR1),6),6);

MA5:=EMA(C,5);

MA13:=EMA(C,13);

UP:=DRAWLINE(L=LLV(L,BARSLAST(CROSS(MA13,MA5))+1),LLV(L,BARSLAST(CROSS

(MA13,MA5))+1),H=HHV(H,BARSLAST(CROSS(MA5,MA13))+1),HHV(H,BARSLAST(CROSS

(MA5,MA13))+1),0),COLOR0000FF;

DOWN:=DRAWLINE(H=HHV(H,BARSLAST(CROSS(MA5,MA13))+1),HHV(H,BARSLAST(CROSS

(MA5,MA13))+1),L=LLV(L,BARSLAST(CROSS(MA13,MA5))+1),LLV(L,BARSLAST(CROSS

(MA13,MA5))+1),0),COLOR00FF00;

BT:(LLV(VAR2,2)=LLV(VAR2,7) AND COUNT(VAR2<0,2) AND CROSS(VAR2,MA(VAR2,2))) AND

REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1);

0,COLORFF00FF;

10,COLORFF0000;

STICKLINE(UP,0,0.2,3,0),COLOR0000FF;

STICKLINE(DOWN,0,0.2,3,0),COLOR00FF00;

STICKLINE(BT,0,3,2,0),COLOR000088;

STICKLINE(BT,0,3,1,0),COLOR0000CC;

STICKLINE(BT,0,3,0.22,0),COLOR0000FF;

DRAWTEXT(BT,3,'短牛'),COLOR0000FF;

TJ1:=REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1) AND C<HHV(H,21)*0.82;

STICKLINE(TJ1,0,2,3,0),COLOR880088;

STICKLINE(TJ1,0,2,1.5,0),COLORAA00AA;

STICKLINE(TJ1,0,2,0.8,0),COLORCC00CC;

STICKLINE(TJ1,0,2,0.2,0),COLORFF00FF;

DRAWTEXT(TJ1,2,'中牛'),COLORFF00FF;

HR:=HHV(HIGH,55);

HRY:=LLV(LOW,55);

HRY11:=HR*HRY;

HRY33:=SQRT(HRY11);

TJ2:=REF(DOWN,1)<REF(DOWN,2) AND UP>REF(DOWN,1) AND C<HRY33;

STICKLINE(TJ2,0,1,5,0),COLOR008888;

STICKLINE(TJ2,0,1,2,0),COLOR00AAAA;

STICKLINE(TJ2,0,1,1,0),COLOR00CCCC;

STICKLINE(TJ2,0,1,0.2,0),COLOR00FFFF;

DRAWTEXT(TJ2,1,'大牛'),COLOR00FFFF;

ST:=REF(UP,1)>REF(UP,2) AND DOWN<REF(UP,1);

STICKLINE(ST,10,9,5,0),COLOR008800;

STICKLINE(ST,10,9,2,0),COLOR00AA00;

STICKLINE(ST,10,9,1,0),COLOR00CC00;

STICKLINE(ST,10,9,0.2,0),COLOR00FF00;

DRAWTEXT(ST,9,'卖'),COLOR00FF00;

指标4

Q_1:=C-REF(C,1);

Q_2:=100*EMA(EMA(Q_1,6),6)/EMA(EMA(ABS(Q_1),6),6);

Q_3:=CROSS(EMA(C,19),EMA(C,7));

Q_4:=CROSS(EMA(C,7),EMA(C,19));

Z1:=L=LLV(L,BARSLAST(Q_3)+1);

Z2:=LLV(L,BARSLAST(Q_3)+1);

Z3:=H=HHV(H,BARSLAST(Q_4)+1);

Z4:=HHV(H,BARSLAST(Q_4)+1);

Q_A:=DRAWLINE(Z1,Z2,Z3,Z4,0);

Y1:=H=HHV(H,BARSLAST(Q_4)+1);

Y2:=HHV(H,BARSLAST(Q_4)+1);

Y3:=L=LLV(L,BARSLAST(Q_3)+1);

Y4:=LLV(L,BARSLAST(Q_3)+1);

Q_B:=DRAWLINE(Y1,Y2,Y3,Y4,0);

TJ:=IF(Q_B<REF(Q_B,1) AND Q_B=Q_A,1,0);

哈哈:IF(REF(TJ,1)=0 AND TJ>=1,80,10),STICK,COLORRED;

(*慎待drawline函数*)

(0)

相关推荐