TYP := (HIGH + LOW + CLOSE)/3; V1:=SUM(IF(TYP>REF(TYP,1),TYP*VOL,0),N1)/SUM(IF(TYP<REF(TYP,1),TYP*VOL,0),N1); MFI:100-(100/(1+V1));
N:=5; J底背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(MFI,N)=LLV(MFI,2*N+1),N+1),N) AND MFI=LLV(MFI,N+1),1))+1)>C AND REF(MFI,BARSLAST(REF(FILTER(BACKSET(REF(MFI,N)=LLV(MFI,2*N+1),N+1),N) AND MFI=LLV(MFI,N+1),1))+1)<MFI AND FILTER(BACKSET(REF(MFI,N)=LLV(MFI,2*N+1),N+1),N) AND MFI=LLV(MFI,N+1),COLORWHITE,NODRAW; DRAWLINE(FILTER(BACKSET(REF(MFI,N)=LLV(MFI,2*N+1),N+1),N) AND MFI=LLV(MFI,N+1),MFI,FILTER(J底背>0,5),MFI,0), COLORRED,DOTLINE; DRAWTEXT(J底背,MFI,'底背離'),COLORRED; J頂背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(MFI,N)=HHV(MFI,2*N+1),N+1),N) AND MFI=HHV(MFI,N+1),1))+1)<C AND REF(MFI,BARSLAST(REF(FILTER(BACKSET(REF(MFI,N)=HHV(MFI,2*N+1),N+1),N) AND MFI=HHV(MFI,N+1),1))+1)>MFI AND FILTER(BACKSET(REF(MFI,N)=HHV(MFI,2*N+1),N+1),N) AND MFI=HHV(MFI,N+1),COLORGREEN,NODRAW; DRAWLINE(FILTER(BACKSET(REF(MFI,N)=HHV(MFI,2*N+1),N+1),N) AND MFI=HHV(MFI,N+1),MFI,FILTER(J頂背>0,5),MFI,0), COLORGREEN,DOTLINE; DRAWTEXT(J頂背,MFI,'頂背離'),COLORGREEN;
|