自动画线通达信公式---从东方红提取的主图公式,转换为通达信公式给大家分享
原东方红上的公式图片:
提取的源码如下:
M1:=5;M2:=10;
HIGHN:=10;LOWN:=10;HIGHDISPLAY:=0;LOWDISPLAY:=0;ZGDISPLAY:=0;MADISPLAY:=0;
AA:=REF(H,HIGHN)=HHV(H,2*HIGHN+1);
QY:=BACKSET(AA,HIGHN+1);
CC:=FILTER(QY,HIGHN) AND H=HHV(H,HIGHN+1);
DRAWICON(CC,H*1.02,2);
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),COLORGREEN,LINETHICK1;
局部低点预选A:=BACKSET(LLV(L,5)
局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0);
缺口判断:=IF(L>REF(H,1),1,IF(H
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOWRANGE(L);
大值周期:=TOPRANGE(H);
低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)
低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2)
低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L
预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);
判断:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 预判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);
判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)
低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0);
低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L
AAAD:=IF(高保留=1 AND 低保留=-1 AND H>REF(H,REF(距前高天,1)+2),1,IF(高保留=1 AND 低保留=-1 AND L
极点保留:=IF(AAAD=0,高保留+低保留,AAAD);
局部极点:=IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) CIRCLEDOT COLORYELLOW;
局部极点A:DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORLIRED;
局部极点B:DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORYELLOW;
DRAWLINE(CURRBARSCOUNT=GDCS2,H,ISLASTBAR,REF(H,GDCS2-1),1),COLOR0055FF;
DRAWLINE(CURRBARSCOUNT=GDCS1,H,ISLASTBAR,REF(H,GDCS1-1),1),COLORYELLOW;
AA1:=REF(L,LOWN)=LLV(L,2*LOWN+1);
QY1:=BACKSET(AA1,LOWN+1);
CC1:=FILTER(QY1,LOWN) AND L=LLV(L,LOWN+1);
DRAWICON(CC1,L*0.98,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) COLORRED,LINETHICK2;
MA1:=MA(CLOSE,M1);
MA2:=MA(CLOSE,M2);
止损:STICKLINE(ISLASTBAR,HHV(C,5)*0.95-0.01,HHV(C,5)*0.95,50,0),COLORWHITE;
{DRAWTEXT(CROSS(EMA(CLOSE,2),EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),(LOW *0.99),'B'),LINETHICK3,COLORF00FF0;
DRAWTEXT(CROSS(EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42),EMA(CLOSE,2)),(HIGH*1.01),'S'),LINETHICK3,COLORFFFFFF;}
DRAWICON(CROSS(EMA(CLOSE,2),EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),LOW*0.99,26),COLORYELLOW;
DRAWICON(CROSS(EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42),EMA(CLOSE,2)),HIGH*1.01,27),COLORGREEN;
STICKLINE((EMA(CLOSE,2) >=
EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),LOW,HIGH,0.1,0),COLOR0000FF;
STICKLINE((EMA(CLOSE,2)
>=
EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),CLOSE,OPEN,3,0),COLOR0000AA;
STICKLINE((EMA(CLOSE,2)
>=
EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),CLOSE,OPEN,2,0),COLOR0000CC;
STICKLINE((EMA(CLOSE,2)
<
EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),CLOSE,OPEN,2,0),COLORCCCC00;
STICKLINE((EMA(CLOSE,2)
<
EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),CLOSE,OPEN,3,0),COLORAAAA00;
STICKLINE((EMA(CLOSE,2)
<
EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42)),LOW,HIGH,0.1,0),COLORFFFF00;
STICKLINE((CROSS(EMA(CLOSE,2),EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42))
OR
CROSS(EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42),EMA(CLOSE,2))),LOW,HIGH,0.1,0),COLOR00FFFF;
STICKLINE((CROSS(EMA(CLOSE,2),EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42))
OR
CROSS(EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42),EMA(CLOSE,2))),OPEN,CLOSE,3,0),COLOR00AAAA;
STICKLINE((CROSS(EMA(CLOSE,2),EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42))
OR
CROSS(EMA(((SLOPE(CLOSE,21)*20)+CLOSE),42),EMA(CLOSE,2))),OPEN,CLOSE,2,0),COLOR00CCCC;