自用实战MACD之红箭头选股指标公式

DIFF:=(EMA(CLOSE,12) - EMA(CLOSE,26));

DEA:=EMA(DIFF,9);

macd2:=(2 * (DIFF - DEA));

DU0:=crOSS(DIFF,0);

UD0:=CROSS(0,DIFF);

TDU0:=BArslAst(DU0);

TUD0:=BARSLAST(UD0);

DU3:=REF(DU0,1);

UD3:=REF(UD0,1);

TDU3:=BARSLAST(DU3);

TUD3:=BARSLAST(UD3);

UDGLINE:=IF((TDU3 < TUD3),REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3));

JDU0:=(((REF(CLOSE,1) <= REF(UDGLINE,1)) AND (CLOSE > UDGLINE)) AND (TDU0 < TUD0));

JUD0:=(((REF(CLOSE,1) >= REF(UDGLINE,1)) AND (CLOSE < UDGLINE)) AND (TUD0 < TDU0));

JDU1:=(JDU0 AND (COUNT(JDU0,TDU0) = 1));

JUD1:=(JUD0 AND (COUNT(JUD0,TUD0) = 1));

DEFUT:=BARSLAST(CROSS(MacD2,0));

DEFDT:=BARSLAST(CROSS(0,MACD2));

DEFUL:=IF((MACD2 >= 0),HHV(MACD2,(DEFUT + 1)),REF(HHV(MACD2,(DEFUT + 1)),(DEFDT + 1)));

DEFU2L:=REF(DEFUL,(DEFUT + 1));

红箭头:((((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND (MACD2 >= 0)) AND (REF(MACD2,1) < REF(DEFU2L,1))) AND (MACD2 > DEFU2L));