S_EMA := EMA(CLOSE,12);

L_EMA := EMA(CLOSE,26);

MACD_LN := S_EMA - L_EMA;

SIG_LN := EMA(MACD_LN,9);

GAIN := SUM(IF(CLOSE > REF(CLOSE, 1), CLOSE - REF(CLOSE, 1), 0), 14);

LOSS := SUM(IF(CLOSE < REF(CLOSE, 1), REF(CLOSE, 1) - CLOSE, 0), 14);

RS := GAIN / LOSS;

RSI_VAL := 100 - (100 / (1 + RS));

VOL_SP := VOL > MA(VOL,10) * 1.5;

BULL_MOM := (CROSS(MACD_LN, SIG_LN)) AND TIME<=0935 AND (RSI_VAL > 50) AND VOL_SP;

BEAR_MOM := (CROSS(SIG_LN, MACD_LN)) AND (RSI_VAL < 50) AND VOL_SP;

{DRAWTEXT_FIX(BEAR_MOM, 0.5, 0.8, 0, 'BEARISH SHIFT'), COLORGREEN;}

STICKLINE(BULL_MOM, LOW, HIGH, 2, 0), COLORMAGENTA;

DRAWTEXT_FIX(BULL_MOM, 0.45, 0.5, 0, '牛'), COLORYELLOW;

{STICKLINE(BEAR_MOM, LOW, HIGH, 1, 0), COLORGREEN;};