A:=MA(CLOSE,17)+ABS(MA(CLOSE,17)-REF(MA(CLOSE,17),1));
B:=MA(CLOSE,17)+MA(CLOSE,17)-REF(MA(CLOSE,17),1);
分水岭:IF(MA(CLOSE,17)<B,B,MA(CLOSE,17)),COLORFF00FF,LINETHICK2;
操作线:分水岭-(EMA(C,3)-分水岭),COLOR00FFFF,LINETHICK2;
PM:MA(C,5),colorwhite,LINETHICK1;
PARTLINE(pm,PM>REF(PM,1),PM),colorred,LINETHICK2;
PARTLINE(pm,PM=REF(PM,1),PM),colorred;
PARTLINE(pm,PM<REF(PM,1),PM),COLORFF9900,LINETHICK2;
S:=(PM>操作线);
DD:=分水岭<REF(分水岭,1);
PARTLINE(分水岭,DD,分水岭),COLOR00FF00,LINETHICK2;
PARTLINE(分水岭,S,分水岭),COLOR00FF00,POINTDOT,LINETHICK4;
DRAWICON(CROSS(分水岭,操作线),分水岭-0.2,'buy');//{买入红箭头}
dif:=EMA(C,12)-EMA(C,26);
dea:=EMA(dif,9);
MACD:=2*(dif-dea);
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
LC := REF(CLOSE,1);
RSI1:=SMA(MAX(CLOSE-LC,0),6,1)/SMA(ABS(CLOSE-LC),6,1)*100;
RSI2:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(DIF,DEA);
DRAWTEXT(B1>0,L-0.02,'MACD底背'),COLOR00FFFF;//{MACD底背离}
C1:=BARSLAST(REF(CROSS(DEA,DIF),1));
D1:=REF(C,C1+1)<C AND REF(DIF,C1+1)>DIF AND CROSS(DEA,DIF);
DRAWTEXT(D1>0,H*1.05,'MACD顶背离'),COLOR00FF00;//{MACD顶背离}
A2:=BARSLAST(REF(CROSS(K,D),1));
B2:=REF(C,A2+1)>C AND REF(K,A2+1)<K AND CROSS(K,D);
DRAWTEXT(B2,L-0.10,'KDJ底背离'),COLORFF00FF;//{KDJ底背离}
C2:=BARSLAST(REF(CROSS(D,K),1));
D2:=REF(C,C2+1)<C AND REF(K,C2+1)>K AND CROSS(D,K);
DRAWTEXT(D2>0,H*1.05,'KDJ顶背离'),COLORFFFFCC;//{KDJ顶背离}
A3:=BARSLAST(REF(CROSS(RSI1,RSI2),1));
B3:=REF(C,A3+1)>C AND REF(RSI1,A3+1)<RSI1 AND CROSS(RSI1,RSI2);
DRAWTEXT(B3>0,L-0.18,'RSI底背离'),COLOR0000FF;//{RSI底背离}
C3:=BARSLAST(REF(CROSS(RSI2,RSI1),1));
D3:=REF(C,C3+1)<C AND REF(RSI1,C3+1)>RSI1 AND CROSS(RSI2,RSI1);
DRAWTEXT(D3>0,H*1.05,'RSI顶背离'),COLORFF9900;//{RSI顶背离};
STICKLINE(CLOSE>OPEN ,HIGH,LOW,1,0 ),COLOR0000FF;
STICKLINE(CLOSE>OPEN ,CLOSE,OPEN,8,0) ,COLor0000ff;
STICKLINE(OPEN>=CLOSE ,HIGH,LOW,1 ,0 ),COLOR00ff00;
STICKLINE(OPEN>=CLOSE ,CLOSE ,OPEN,8,0 ),COLor00ff00;
|