老師,麻煩把下面的改成選股公式。謝謝
?
//策略名:MACD背離模型
//類型:股票t+0
//適用:后臺程序化
//使用市場:個股
DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA),COLORSTICK;
N:=BARSLAST(CROSS(DIFF,DEA))+1;
N1:=BARSLAST(CROSS(DEA,DIFF))+1;
DIFF1:=REF(REF(DIFF,N-1),1);
DIFF2:=REF(REF(DIFF,N1-1),1);
C1:=REF(REF(C,N-1),1);
C2:=REF(REF(C,N1-1),1);
DBL1:=DIFF > DIFF1 AND CROSS(DIFF,DEA) AND C >C1; //底背離
DBL:=DIFF<DIFF2 AND? CROSS(DEA,DIFF) AND C < C2; //頂背離
TBUY(DBL1 AND TNUMLOSSTRADE < 2,100,MKT);
TSELL(DBL AND TBUYHOLDINGEX('','',2) > 0,100,MKT);
TSELL(EVERY(C <= REF(C,1),5),0,MKT);
?