自动黄金折返点位公式
源码
N:=SYSPARAM(3)-SYSPARAM(1);
A:=BACKSET(ISLASTBAR,HHVBARS(H,N)+1);
B:=COUNT(A,N)=1;
前高:IF(N>0,REF(H,BARSLAST(B)),0),COLORWHITE;
A2:=BACKSET(ISLASTBAR,LLVBARS(L,N)+1);
B2:=A2>REF(A2,1);
前低:REF(L,BARSLAST(B2)),COLORWHITE;
hh:= 前高;
ll:= 前低;
HL:=hh-ll;
wH := BARSlast(H=hh);
wL :=BARSlast(L=ll);
KK := wH-wL;
{a1 :=if(kk<0,hh- HL*0.236,ll+HL*0.236);}
a2 :=if(kk<0,hh- HL*0.382,ll+HL*0.382);
a3 :=if(kk<0,hh- HL*0.618,ll+HL*0.618);
F3:A2,COLORGREEN,LINETHICK;
F5:A3,COLORYELLOW,LINETHICK;
mHL:= hh-HL*0.5;
A := islastbar;
DRAWTEXT(A and K<>3 ,HH, ' 最高价:'+NUMTOSTR(HH,3)),ALIGN2,colorgreen;
DRAWTEXT(A and K<>3 ,LL, ' 最低价:'+NUMTOSTR(ll,3)),ALIGN2,,colorgreen;
{DRAWTEXT(A and K<>3 ,mHL,' 50%:'+NUMTOSTR(mHL,3)),ALIGN2,colorred;}
{DRAWTEXT(A and K=1, a1, ' 0.236:'+NUMTOSTR(a1,3)),ALIGN2,colorgreen;}
DRAWTEXT(A and K=1, a2, ' ☆F3☆:'+NUMTOSTR(a2,3)),ALIGN2,colorgreen;
DRAWTEXT(A and K=1, a3, ' ☆F5☆:'+NUMTOSTR(a3,3)),ALIGN2,colorred;
DRAWTEXT(A and K<>3,HH, '  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄'),ALIGN2,colorred,linethick7;
DRAWTEXT(A and K<>3,LL, '  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ 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