{背景}
DRAWGBK(C>0, RGB(1,1,1),RGB(1,1,1),0,'0',0);
STICKLINE(C>0,-100,100,28,0)COLOR000840;
STICKLINE(C>0,200,200,28,-1)COLOR000080;
STICKLINE(C>0,100,100,28,-1)COLOR000080;
STICKLINE(C>0,-2.5,2.5,28,0)COLOR000080;
STICKLINE(C>0,-100,-100,28,-1)COLOR000080;
STICKLINE(C>0,-200,-200,28,-1)COLOR000080;
TYP:=(HIGH+LOW+CLOSE)/3;
CCI:=(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),STICK;{CCI柱線}
趨勢線:EXPMA(CCI,4.5),COLORFF8000,NODRAW;{CCI的5天EMA}
DRAWBAND(CCI,RGB(128,0,0),趨勢線,RGB(0,128,0));
STICKLINE(CCI>=0,0,CCI,0,-1),COLORLIRED;{紅柱}
STICKLINE(CCI<0,0,CCI,0,-1),COLORLIBLUE;{綠柱}
{CCI}
{TYP:=(HIGH+LOW+CLOSE)/3;}
CCI值:(TYP-MA(TYP,14))/(0.015*AVEDEV(TYP,14)),COLORYELLOW,LINETHICK1;{CCI線}
DRAWTEXT(ISLASTBAR,CCI值,' ←CCI'),COLORYELLOW;
{CCI背離}
N:=5;
CCI底背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),1))+1)>C AND
REF(CCI,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),1))+1)<CCI AND
FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(CCI,N)=LLV(CCI,2*N+1),N+1),N) AND CCI=LLV(CCI,N+1),CCI,FILTER(CCI底背>0,5),CCI,0),
COLORWHITE,DOTLINE;
DRAWTEXT(CCI底背,CCI,'底背'),COLORWHITE;
CCI頂背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),1))+1)<C AND
REF(CCI,BARSLAST(REF(FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),1))+1)>CCI AND
FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(CCI,N)=HHV(CCI,2*N+1),N+1),N) AND CCI=HHV(CCI,N+1),CCI,FILTER(CCI頂背>0,5),CCI,0),
COLORGREEN,DOTLINE;
DRAWTEXT(CCI頂背,CCI,'頂背'),COLORGREEN;
{趨勢線的背離}
趨勢線底背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(趨勢線,N)=LLV(趨勢線,2*N+1),N+1),N) AND 趨勢線=LLV(趨勢線,N+1),1))+1)>C AND
REF(趨勢線,BARSLAST(REF(FILTER(BACKSET(REF(趨勢線,N)=LLV(趨勢線,2*N+1),N+1),N) AND 趨勢線=LLV(趨勢線,N+1),1))+1)<趨勢線 AND
FILTER(BACKSET(REF(趨勢線,N)=LLV(趨勢線,2*N+1),N+1),N) AND 趨勢線=LLV(趨勢線,N+1),COLORWHITE,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(趨勢線,N)=LLV(趨勢線,2*N+1),N+1),N) AND 趨勢線=LLV(趨勢線,N+1),趨勢線,FILTER(趨勢線底背>0,5),趨勢線,0),
COLORWHITE,DOTLINE;
DRAWTEXT(趨勢線底背,趨勢線,'趨勢底背'),COLORFF80FF;
趨勢線頂背:=REF(C,BARSLAST(REF(FILTER(BACKSET(REF(趨勢線,N)=HHV(趨勢線,2*N+1),N+1),N) AND 趨勢線=HHV(趨勢線,N+1),1))+1)<C AND
REF(趨勢線,BARSLAST(REF(FILTER(BACKSET(REF(趨勢線,N)=HHV(趨勢線,2*N+1),N+1),N) AND 趨勢線=HHV(趨勢線,N+1),1))+1)>趨勢線 AND
FILTER(BACKSET(REF(趨勢線,N)=HHV(趨勢線,2*N+1),N+1),N) AND 趨勢線=HHV(趨勢線,N+1),COLORGREEN,NODRAW;
DRAWLINE(FILTER(BACKSET(REF(趨勢線,N)=HHV(趨勢線,2*N+1),N+1),N) AND 趨勢線=HHV(趨勢線,N+1),趨勢線,FILTER(趨勢線頂背>0,5),趨勢線,0),
COLORGREEN,DOTLINE;
DRAWTEXT(趨勢線頂背,趨勢線,'趨勢頂背'),COLORFF8000;
{面積背離}
JC:= 0-CCI;
綠柱面積:=IF(CCI<0,SUM(CCI,BARSLAST(JC<0)),0);
紅柱面積:=IF(CCI>0,SUM(CCI,BARSLAST(JC>0)),0);
本次最低價:=LLV(L,BARSLAST(JC<0));
本次最高價:=HHV(H,BARSLAST(JC>0));
X1:=IF (CCI<0,BARSLAST(CROSS(CCI,0)),0);
前次綠柱面積:=REF(綠柱面積,X1+1);
前次最低價:=REF(本次最低價,X1+1);
Y1:=IF((綠柱面積<0 AND ABS(綠柱面積)<ABS(前次綠柱面積) AND 本次最低價<前次最低價 ),1,0);
RS1:= CCI<0 AND REF(CCI,1)<0 AND C<前次最低價
AND ABS(綠柱面積)<ABS(前次綠柱面積) AND ABS(CCI)<ABS(REF(CCI,1));
底背馳:= IF (CROSS(CCI,0),REF(Y1,1),0);
DRAWTEXT(底背馳,LLV(CCI,5),'←面積底背'),COLORLIRED;
X2:=IF (CCI>0,BARSLAST(CROSS(0,CCI)),0);
前次紅柱面積:=REF(紅柱面積,X2+1);
前次最高價:=REF(本次最高價,X2+1);
Y2:=IF((紅柱面積>0 AND 紅柱面積<前次紅柱面積 AND 本次最高價>前次最高價 ),1,0);
RS2:= CCI>0 AND REF(CCI,1)>0 AND C>前次最高價 AND ABS(紅柱面積)<ABS(前次紅柱面積) AND ABS(CCI)<ABS(REF(CCI,1));
頂背馳:= IF (CROSS(0,CCI),REF(Y2,1),0);
DRAWTEXT(頂背馳,HHV(CCI,5),'←面積頂背'),COLORCYAN;
聯(lián)系客服