DIF:EMA(CLOSE,12)-EMA(CLOSE,26)COLORRED,LINETHICK1; DEA:EMA(DIF,9); IF(DIF<DEA,DIF,DRAWNULL),COLORWHITE,LINETHICK1; MACD:(DIF-DEA)*2,COLORSTICK; DRAWBAND(DIF,RGB(192,105,26),DEA,RGB(18,128,144)); STICKLINE(MACD.MACD>REF(MACD.MACD,1),0,MACD.MACD,0.5,0),COLORRED; STICKLINE(MACD.MACD>REF(MACD.MACD,1) AND MACD.MACD<0,0,MACD.MACD,0.5,0),COLORMAGENTA; STICKLINE(MACD.MACD<=REF(MACD.MACD,1),0,MACD.MACD,0.5,0),COLORCYAN; STICKLINE(MACD.MACD<=REF(MACD.MACD,1) AND MACD.MACD<0,0,MACD.MACD,0.5,0),COLORLIGREEN; VAR1:=3;VAR2:=3; 筆低A:=LOW<=LLV(LOW,VAR1),NODRAW; 筆高A:=HIGH>=HHV(HIGH,VAR1),NODRAW; 筆低:=筆低A AND 筆高A=0,NODRAW; 筆高:=筆高A AND 筆低A=0,NODRAW; 上筆:=DRAWLINE(筆低,LOW,筆高,HIGH,0)COLOR0000FF; 下筆:=DRAWLINE(筆高,HIGH,筆低,LOW,0),COLOR00FF00; 拐下:=上筆>REF(上筆,1) AND 下筆>REFX(下筆,1),NODRAW; 拐上:=下筆<REF(下筆,1) AND 上筆<REFX(上筆,1),NODRAW; 段低A:=LOW<=LLV(LOW,VAR2*VAR1),NODRAW; 段高A:=HIGH>=HHV(HIGH,VAR2*VAR1),NODRAW; 段低:=段低A AND 段高A=0,NODRAW; 段高:=段高A AND 段低A=0,NODRAW; 上段:=DRAWLINE(段低,LOW,段高,HIGH,0),LINETHICK1,COLORMAGENTA; 下段:=DRAWLINE(段高,HIGH,段低,LOW,0),LINETHICK1,COLORFF8000; 特殊底:=下段=上段 AND 段低 AND MACD<0,NODRAW; TTT:=REF(BARSLAST(特殊底),1)+1; 底背離1:=特殊底 AND LOW<REF(LOW,TTT) AND DIF>REF(DIF,TTT) AND LLV(DIF,BARSLASTCOUNT(MACD<0))>REF(DIF,TTT),NODRAW; 底背左點1:=BACKSET(底背離1,TTT+1) AND REF(BACKSET(底背離1,TTT+1),1)=0 AND 特殊底; DRAWLINE(底背左點1,DIF,底背離1,DIF,0),COLORFF00FF,LINETHICK1; 底背離2:=特殊底 AND LOW<REF(LOW,TTT) AND MACD>REF(MACD,TTT) AND LLV(MACD,BARSLASTCOUNT(MACD<0))>REF(MACD,TTT),NODRAW; 底背左點2:=BACKSET(底背離2,TTT+1) AND REF(BACKSET(底背離2,TTT+1),1)=0 AND 特殊底; DRAWLINE(底背左點2,MACD,底背離2,MACD,0),COLORFF00FF,LINETHICK1; 特殊頂:=下段=上段 AND 段高 AND MACD>0,NODRAW; TTTG:=REF(BARSLAST(特殊頂),1)+1; 頂背離1:=特殊頂 AND HIGH>REF(HIGH,TTTG) AND DIF<REF(DIF,TTTG) AND HHV(DIF,BARSLASTCOUNT(MACD>0))<REF(DIF,TTTG),NODRAW; 頂背左點1:=BACKSET(頂背離1,TTTG+1) AND REF(BACKSET(頂背離1,TTTG+1),1)=0 AND 特殊頂; DRAWLINE(頂背左點1,DIF,頂背離1,DIF,0),COLORGREEN,LINETHICK2; 頂背離2:=特殊頂 AND HIGH>REF(HIGH,TTTG) AND MACD<REF(MACD,TTTG) AND HHV(MACD,BARSLASTCOUNT(MACD>0))<REF(MACD,TTTG),NODRAW; 頂背左點2:=BACKSET(頂背離2,TTTG+1) AND REF(BACKSET(頂背離2,TTTG+1),1)=0 AND 特殊頂; DRAWLINE(頂背左點2,MACD,頂背離2,MACD,0),COLORGREEN,LINETHICK1; DRAWTEXT(底背離2=1,MACD,' 柱背離'),COLORFF00FF; DRAWTEXT(底背離1=1,DIF,' 線背離'),COLORFF00FF; DRAWTEXT(頂背離2=1,MACD,' 柱背離'),COLORGREEN; DRAWTEXT(頂背離1=1,DIF,' 線背離'),COLORGREEN; DRAWICON(REF(DIF,1)>REF(DIF,2) AND DIF<REF(DIF,1) AND DIF>0 AND DIF>DEA,DIF*1.1,2),COLORGREEN; DRAWICON(REF(DIF,1)<REF(DIF,2) AND DIF>REF(DIF,1) AND DIF<0 AND DIF<DEA,DIF*1.1,1),COLORRED; XA_2:=BARSLAST(REF(MACD,1)<0 AND MACD>0); XA_3:=LLVBARS(MACD,XA_2+20); XA_4:=IF(XA_3>XA_2,REF(MACD,XA_3),0); XA_5:=MACD<0 AND MACD>XA_4 AND LOW=LLV(LOW,XA_2+20) AND XA_4<0; 柱背離1:=(REF(XA_5,1)=1 AND MACD>REF(MACD,1) AND REF(DIF,XA_3)<0 AND MACD<0),NODRAW; DRAWLINE(XA_4=XA_3,MACD,柱背離1,MACD,0),COLORCYAN,LINETHICK1; DRAWICON(柱背離1,0,26); 柱背離A:BARSLAST(柱背離1>0)+1,COLORYELLOW,NODRAW; 柱背離:BARSLAST(底背離2>0)+1,COLORMAGENTA,NODRAW; 線背離:BARSLAST(底背離1>0)+1,COLORWHITE,NODRAW; |
|