归壹指标,源码分享。
{归壹指标}
{基本模块}
MA4:MA(CLOSE,144)COLORGRAY;
MA3:MA(CLOSE,55)COLORLIGREEN;
MA2:MA(CLOSE,34)COLORCYAN;
MA1:MA(CLOSE,20)COLORRED;
{红绿黄模块}
N1:=18;N2:=50;N3:=32;
CPX:=(MA(CLOSE,8)*N1/100+MA(CLOSE,30)*N2/100+MA(CLOSE,60)*N3/100);
NOTEXTWS:=CPX>REF(CPX,1) AND MA(CLOSE,30)>REF(MA(CLOSE,30),1) AND CLOSE>CPX AND CLOSE>MA(CLOSE,30),NODRAW;
NOTEXTWX:=CPX<=REF(CPX,1) AND MA(CLOSE,30)<=REF(MA(CLOSE,30),1) AND CLOSE<CPX AND CLOSE<MA(CLOSE,30),NODRAW;
STICKLINE(C>=O,L,H,0,0),COLORYELLOW;
STICKLINE(C>=O,C,O,2.0,1),COLORYELLOW;
STICKLINE(C<O,L,H,0,0),COLORYELLOW;
STICKLINE(C<O,C,O,2.0,0),COLORYELLOW;
STICKLINE(C>=O AND NOTEXTWS=1,L,H,0,0),COLORRED;
STICKLINE(C>=O AND NOTEXTWS=1,C,O,2.0,1),COLORRED;
STICKLINE(C<O AND NOTEXTWS=1,L,H,0,0),COLORRED;
STICKLINE(C<O AND NOTEXTWS=1,C,O,2.0,0),COLORRED;
STICKLINE(C>=O AND NOTEXTWX=1,L,H,0,0),COLORCYAN;
STICKLINE(C>=O AND NOTEXTWX=1,C,O,2.0,1),COLORCYAN;
STICKLINE(C<O AND NOTEXTWX=1,L,H,0,0),COLORCYAN;
STICKLINE(C<O AND NOTEXTWX=1,C,O,2.0,0),COLORCYAN;
STICKLINE(C>=O AND PERIOD=5 AND C>REF(C,1)*1.0992,L,H,0,0),COLORMAGENTA;
STICKLINE(C>=O AND PERIOD=5 AND C>REF(C,1)*1.0992,C,O,2.0,1),COLORMAGENTA;
STICKLINE(C<O AND PERIOD=5 AND C>REF(C,1)*1.0992,L,H,0,0),COLORMAGENTA;
STICKLINE(C<O AND PERIOD=5 AND C>REF(C,1)*1.0992,C,O,2.0,0),COLORMAGENTA;
{漏洞模块}
SHORT:=12;LONG:=26;MID:=9;
DIF:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:=EMA(DIF,MID);
MACD:=(DIF-DEA)*2;
MACD金叉:=CROSS(DIF,DEA);
MACD死叉:=CROSS(DEA,DIF);
MACD金叉以来:=BARSLAST(MACD金叉);
均线死叉1:=CROSS(MA(CLOSE,8),MA(CLOSE,4));
均线死叉2:=CROSS(MA(CLOSE,10),MA(CLOSE,5));
均线死叉3:=CROSS(MA(CLOSE,12),MA(CLOSE,5));
均线死叉4:=CROSS(MA(CLOSE,13),MA(CLOSE,5));
五日线拐点:=MA(CLOSE,5)>REF(MA(CLOSE,5),1) AND REF(MA(CLOSE,5),1)<REF(MA(CLOSE,5),2);
均线金叉以来:=BARSLAST(CROSS(MA(CLOSE,13),MA(CLOSE,34)));
形成洗盘松:=
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=9 AND COUNT(均线死叉1,均线金叉以来)=1 AND 均线死叉1) OR
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=9 AND COUNT(均线死叉2,均线金叉以来)=1 AND 均线死叉2) OR
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=9 AND COUNT(均线死叉3,均线金叉以来)=1 AND 均线死叉3) OR
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=9 AND COUNT(均线死叉4,均线金叉以来)=1 AND 均线死叉4);
LDXT松:=EXIST(形成洗盘松,4) AND C>MA(CLOSE,13) AND MACD>REF(MACD,1) AND MA(CLOSE,5)>MA(CLOSE,55) AND EXIST(五日线拐点,3);
STICKLINE(C>=O AND LDXT松,L,H,0,0),COLORLIGRAY;
STICKLINE(C>=O AND LDXT松,O,C,2.0,1),COLORLIGRAY;
STICKLINE(C<O AND LDXT松,L,H,0,0),COLORLIGRAY;
STICKLINE(C<O AND LDXT松,O,C,2.0,0),COLORLIGRAY;
形成洗盘严:=
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=14 AND COUNT(均线死叉2,均线金叉以来)=1 AND 均线死叉2) OR
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=14 AND COUNT(均线死叉3,均线金叉以来)=1 AND 均线死叉3) OR
(EVERY(MACD>0,MACD金叉以来) AND MACD金叉以来>=14 AND COUNT(均线死叉4,均线金叉以来)=1 AND 均线死叉4);
LDXT严:=EXIST(形成洗盘严,2) AND C>MA(CLOSE,13) AND MACD>REF(MACD,1);
STICKLINE(C>=O AND LDXT严,L,H,0,0),COLOR279FD3;
STICKLINE(C>=O AND LDXT严,O,C,2.0,1),COLOR279FD3;
STICKLINE(C<O AND LDXT严,L,H,0,0),COLOR279FD3;
STICKLINE(C<O AND LDXT严,O,C,2.0,0),COLOR279FD3;
TP:=(EXIST(LDXT松,7) AND MACD>REF(HHV(MACD,MACD金叉以来),BARSLAST(LDXT松)+1)) OR
(EXIST(LDXT严,7) AND MACD>REF(HHV(MACD,MACD金叉以来),BARSLAST(LDXT严)+1));
STICKLINE(C>=O AND TP,L,H,0,0),COLORLIGREEN;
STICKLINE(C>=O AND TP,O,C,2.0,1),COLORLIGREEN;
STICKLINE(C<O AND TP,L,H,0,0),COLORLIGREEN;
STICKLINE(C<O AND TP,O,C,2.0,0),COLORLIGREEN;
{归壹模块}
死叉3455:=CROSS(MA(CLOSE,55),MA(CLOSE,34));
死叉3455以来:=BARSLAST(死叉3455);
买入信号预:=(MA(CLOSE,34)<MA(CLOSE,55) OR BARSLAST(CROSS(MA(CLOSE,34),MA(CLOSE,55)))<=16) AND (LDXT松 OR LDXT严);
买入信号:=买入信号预 AND COUNT(买入信号预,BARSLAST(CROSS(DIF,0)))=1;
买前低点:=REF(LLV(L,死叉3455以来+30),BARSLAST(买入信号)+1);
NOTEXT止损:IF(BARSLAST(买入信号)<=2,买前低点,DRAWNULL),COLORRED,LINETHICK2;
DRAWTEXT(买入信号,买前低点,'归壹'),COLORRED,DRAWABOVE;
{信息模块}
DRAWTEXT_FIX(ISLASTBAR=1,0,0,0,HYBLOCK)COLORLIGRAY;
DRAWTEXT_FIX(ISLASTBAR=1,0.1,0,0,ZDBLOCK)COLORLIGRAY;
DRAWTEXT_FIX(ISLASTBAR=1,0.0,0.05,0,GNBLOCK)COLORLIGRAY;
DRAWTEXT_FIX(ISLASTBAR=1,0.0,0.1,0,STRCAT('解禁:',EXTERNSTR(0,666))),COLORLIGRAY;