通达信目标预测主图指标公式
通达信MACD推演优化指标公式
通达信目标预测主图指标公式:
stICKLINE(C>O AND L>REF(H,1),CLOSE,OPEN,3,1),COLORYELLOW;
STICKLINE(C<O AND L>REF(H,1),CLOSE,OPEN,3,0),COLORCYAN;
STICKLINE(C>O AND H<REF(L,1),CLOSE,OPEN,3,1),COLORMAGENTA;
STICKLINE(C<O AND H<REF(L,1),CLOSE,OPEN,3,0),COLORGREEN;
VARA01:=BArslAST(L>REF(H,1));
VARA02:=BARSLAST(H<REF(L,1));
STICKLINE(VARA01>0,REF(L,VARA01),REF(L,VARA01),2,0),COLORMAGENTA;
STICKLINE(VARA01>0,REF(H,VARA01+1),REF(H,VARA01+1),2,0),COLORMAGENTA;
STICKLINE(VARA02>0,REF(H,VARA02),REF(H,VARA02),2,0),COLORGREEN;
STICKLINE(VARA02>0,REF(L,VARA02+1),REF(L,VARA02+1),2,0),COLORGREEN;
{ABC}N:=(1,99,10);
A1:=REF(HIGH,3)=HHV(HIGH,N);
B1:=FILTER(A1,3);
C1:=BacKSET(B1,3+1);
D1:=FILTER(C1,3);{高点}
A2:=REF(LOW,3)=LLV(LOW,N);
B2:=FILTER(A2,3);
C2:=BACKSET(B2,3+1);
D2:=FILTER(C2,3);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E2:=(HIGH+LOW)/2;{高低点出现在同一k线上时可作取舍}
H1:=(D1 AND NOT(D2 AND E1>=E2)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H2:=D1 AND NOT(D2 AND E1>=E2);
L1:=D2 AND NOT(D1 AND E1=E2);
X1:=REF(BARSLAST(H1),1)+1;
F1:=BACKSET(H1 AND COUNT(L1,X1)>0,LLVBARS(IF(L1,LOW,10000),X1));
G1:=F1>REF(F1,1);
I1:=BACKSET(G1,2);
LD:=I1>REF(I1,1);{过滤后低点}
L2:=LD OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(L2),1)+1;
F2:=BACKSET(L2 AND COUNT(H2,X2)>0,HHVBARS(IF(H2,HIGH,0),X2));
G2:=F2>REF(F2,1);
I2:=BACKSET(G2,2);
HD:=I2>REF(I2,1);{过滤后高点}
{DRAWLINE(LD,L,HD,H,0),COLORYELLOW;
DRAWLINE(HD,H,LD,L,0),COLORYELLOW;}{转折画线}
J1:=BACKSET(BARSTATUS=2,MIN(BARSLAST(HD),BARSLAST(LD))+1);
J2:=J1>REF(J1,1);
UU:=BACKSET(BARSTATUS=2,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
WWQ:=BACKSET(XX,REF(BARSLAST(LD),1)+2);
XXQ:=WWQ>REF(WWQ,1);
下轨:DRAWLINE(XX,L,VV,L,1),COLORLIGRAY;{画趋势线}
UU2:=BACKSET(BARSTATUS=2,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
WW3Q:=BACKSET(XX2,REF(BARSLAST(HD),1)+2);
XX3Q:=WW3Q>REF(WW3Q,1);
WW4Q:=BACKSET(XX3Q,REF(BARSLAST(HD),1)+2);
XX4Q:=WW4Q>REF(WW4Q,1);
上轨:DRAWLINE(XX2,H,VV2,H,1),COLORLIGRAY;{画趋势线}
Q0:=BARSLAST(XX2>0);
Q1:=BARSLAST(XX>0);
Q2:=BARSLAST(WW2>0);
Q3:=BARSLAST(VV>0);
Q4:=BARSLAST(XXQ>0);
Q5:=BARSLAST(XX3Q>0);
OA周:=Q0-Q1+1;AB周:=Q1-Q2+1;BC周:=Q2-Q3+1;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.80,0.01,1,STRCAT('◆―【A】: ',STRCAT(CON2STR(OA周,0),'天')))COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.80,0.04,1,STRCAT('【A】―【B】: ',STRCAT(CON2STR(AB周,0),'天')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.80,0.07,1,STRCAT('【B】―【C】: ',STRCAT(CON2STR(BC周,0),'天')))COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)>Q4,0.80,0.10,1,STRCAT('【C】―--: ',STRCAT(CON2STR(Q3,0),'天')))COLORYELLOW;
{123周期}
Z01:=Q1-Q0+1;Z12:=Q0-Q3+1;Z23:=Q3-Q2+1;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.80,0.01,1,STRCAT('低1―高2: ',STRCAT(CON2STR(Z01,0),'天')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.80,0.04,1,STRCAT('高2―低2: ',STRCAT(CON2STR(Z12,0),'天')))COLOR00FF00;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.80,0.07,1,STRCAT('低2―高3: ',STRCAT(CON2STR(Z23,0),'天')))COLORRED;
DRAWTEXT_FIX(CURRBARSCOUNT=1 AND(Q5)<Q4,0.80,0.10,1,STRCAT('高3―-- : ',STRCAT(CON2STR(Q2,0),'天')))COLORYELLOW;
DRAWTEXT( VV=1 AND Q0>Q1,L,'【C】')COLORWHITE;
DRAWTEXT(VV2=1 AND Q0>Q1,H,'【B】')COLORWHITE;
DRAWTEXT( XX=1 AND Q0>Q1,L,'【A】')COLORWHITE;
{DRAWTEXT(XX2=1 AND Q5>Q4 ,H,'◆')COLORWHITE;}
IF(XX2=1 AND Q5>Q4 ,H,DRAWNULL),COLORGREEN,LINETHICK5,CIRCLEDOT;
{DRAWTEXT(XXQ=1 AND Q5>Q4 ,L,'')COLORWHITE;}
IF(XXQ=1 AND Q5>Q4 ,L,DRAWNULL),COLORRED,LINETHICK5,CIRCLEDOT;
DRAWLINE(XXQ=1 AND Q5>Q4 ,L,XX2=1 AND Q5>Q4 ,H,0),COLORRED;
DRAWLINE(VV2=1 AND Q0>Q1,H, VV=1 AND Q0>Q1,L,0),COLORGREEN;
DRAWLINE( XX=1 AND Q0>Q1,L,VV2=1 AND Q0>Q1,H,0),COLORRED;
DRAWLINE(XX2=1 AND Q5>Q4 ,H, XX=1 AND Q0>Q1,L,0),COLORGREEN;
DRAWTEXT( VV=1 AND Q0<Q1,L,'(低2)')COLORWHITE;
DRAWTEXT(VV2=1 AND Q0<Q1,H,'(高3)')COLORWHITE;
DRAWTEXT(XX2=1 AND Q0<Q1,H,'(高2)')COLORWHITE;
DRAWTEXT(XX=1 AND Q5<Q4,L,'(低1)')COLORWHITE;
DRAWTEXT(XX3Q=1 AND Q5<Q4,H,'(高1)')COLORWHITE;
DRAWLINE(XX3Q=1 AND Q5<Q4,H,XX=1 AND Q5<Q4,L,0),COLORGREEN;
DRAWLINE(XX=1 AND Q5<Q4,L,XX2=1 AND Q0<Q1,H,0),COLORRED;
DRAWLINE(XX2=1 AND Q0<Q1,H, VV=1 AND Q0<Q1,L,0),COLORGREEN;
DRAWLINE(VV=1 AND Q0<Q1,L,VV2=1 AND Q0<Q1,H,0),COLORRED;
笔:DRAWLINE(J2,IF(HD,H,L),BARSTATUS=2,IF(BARSLAST(HD)>BARSLAST(LD),H,L),0),DOTLINE,COLORYELLOW;
TL:=1000000+160526;DRAWTEXT(DATE=TL ,L*0.997,'DA')COLORCYAN;
TH:=1000000+160606;DRAWTEXT(DATE=TH ,H,'DB')COLORCYAN,DRAWAbovE;
TC:=1000000+160624;DRAWTEXT(DATE=TC ,L*0.997,'DC')COLORCYAN;
TO:=1000000+160413;DRAWTEXT(DATE=TO ,H,'DO')COLORCYAN DRAWABOVE;
IF(DATE=TO ,H,DRAWNULL),COLORCYAN,LINETHICK5,CIRCLEDOT;
IF(DATE=TC ,L,DRAWNULL),COLORWHITE,LINETHICK5,CIRCLEDOT;
AL:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(HIGH,TL),REFDATE(LOW,TL));
BH:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(LOW,TH),REFDATE(HIGH,TH));
CZF:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(HIGH,TC),REFDATE(LOW,TC));
DJB:=IF(REFDATE(CLOSE,TL)>REFDATE(CLOSE,TH),REFDATE(LOW,TO),REFDATE(HIGH,TO));
OP:=BH-AL+CZF;
COP:=0.618*(BH-AL)+CZF;
XOP:=IF((1.618*(BH-AL)+CZF)<0,OP,1.618*(BH-AL)+CZF);
TODAY:=DATE;
STICKLINE(DATE=TC,CZF,XOP,0,-1),COLORYELLOW;
DRAWLINE(DATE=TC,COP,DATE=TODAY,COP,1),DOTLINE,COLORYELLOW;
DRAWLINE(DATE=TC,OP,DATE=TODAY,OP,1),DOTLINE,COLORYELLOW;
DRAWLINE(DATE=TC,XOP,DATE=TODAY,XOP,1),DOTLINE,COLORYELLOW;
DRAWTEXT(DATE=TC,COP*1.002,'COP=0.618'),COLORYELLOW ;
DRAWTEXT(DATE=TC,OP*1.002,'OP=1.000'),COLORYELLOW;
DRAWTEXT(DATE=TC,XOP*1.002,'XOP=1.618'),COLORYELLOW ;
DRAWNUMBER(DATE=TC,COP,COP),COLORYELLOW;
DRAWNUMBER(DATE=TC,OP,OP),COLORYELLOW;
DRAWNUMBER(DATE=TC,XOP,XOP),COLORYELLOW;
DRAWLINE(DATE=TO,DJB,DATE=TL,AL,0) ,COLORYELLOW;
DRAWLINE(DATE=TL,AL,DATE=TH,BH,0) ,COLORYELLOW;
DRAWLINE(DATE=TH,BH,DATE=TC,CZF,0) ,COLORYELLOW;
通达信最新极品超赞指标主图指标公式