该公式整合了六个关键指标:MACD、KDJ、RSI、LWR、BBI 和 MTM。MACD(指数平滑异同移动平均线)通过比较12日和26日指数移动平均线(EMA)的差值及其9日EMA来检测趋势方向和强度。KDJ(随机指标)通过将当前收盘价与特定时期内的价格范围进行比较,并通过简单移动平均线(SMA)平滑,来识别潜在的买卖信号。RSI(相对强弱指数)衡量价格变动的速度和幅度,通过比较9日和26日周期内的涨跌幅,来指示超买或超卖状态。LWR(威廉指标)通过将收盘价相对于特定时期内的最高价进行测量,并通过SMA平滑处理。BBI(多空指数)通过对3日、9日、12日和26日的收盘价进行平均,以识别总体价格趋势。最后,MTM(动量指标)通过两个EMA平滑计算收盘价的变化率,以指示价格变动的强度。每个指标在其计算值满足特定条件时会触发“交叉”状态,共同识别潜在的交易机会。

主图:

DIFF:=EMA(CLOSE,12)-EMA(CLOSE,26); DEA:=EMA(DIFF,9); DRAWICON(DIFF>DEA,1,1); DRAWICON(DIFF<DEA,1,2); MACD金叉:=DIFF>DEA; DRAWTEXT(ISLASTBAR=1,5.9,'.MACD'),COLORFFFFFF; RSV:=(CLOSE-LLV(LOW,12))/(HHV(HIGH,12)-LLV(LOW,12))*100; K:=SMA(RSV,3,1); D:=SMA(K,3,1); DRAWICON(K>D,2,1); DRAWICON(K<D,2,2); KDJ金叉:=K>D; DRAWTEXT(ISLASTBAR=1,4.9,'.KDJ'),COLORFFFFFF; LC:=REF(CLOSE,1); RSI1:=(SMA(MAX(CLOSE-LC,0),9,1))/(SMA(ABS(CLOSE-LC),9,1))*100; RSI2:=(SMA(MAX(CLOSE-LC,0),26,1))/(SMA(ABS(CLOSE-LC),26,1))*100; DRAWICON(RSI1>RSI2,3,1); DRAWICON(RSI1<RSI2,3,2); RSI金叉:=RSI1>RSI2; DRAWTEXT(ISLASTBAR=1,3.9,'.RSI'),COLORFFFFFF; LWR1:=SMA(RSV,3,1); LWR2:=SMA(LWR1,3,1); DRAWICON(LWR1>LWR2,4,1); DRAWICON(LWR1<LWR2,4,2); LWR金叉:=LWR1>LWR2; DRAWTEXT(ISLASTBAR=1,2.9,'.LWR'),COLORFFFFFF; BBI:=(MA(CLOSE,3)+MA(CLOSE,9)+MA(CLOSE,12)+MA(CLOSE,26))/4; DRAWICON(CLOSE>BBI,5,1); DRAWICON(CLOSE<BBI,5,2); BBI金叉:=CLOSE>BBI; DRAWTEXT(ISLASTBAR=1,1.9,'.BBI'),COLORFFFFFF; MTM:=CLOSE-REF(CLOSE,1); 动量:=100*EMA(EMA(MTM,9),9)/EMA(EMA(ABS(MTM),9),3); CXHZB:=100*EMA(EMA(MTM,26),12)/EMA(EMA(ABS(MTM),26),12); DRAWICON(动量>CXHZB,6,1); DRAWICON(动量<CXHZB,6,2); MTM金叉:=动量>CXHZB; DRAWTEXT(ISLASTBAR=1,0.9,'.MTM'),COLORFFFFFF; 程序化指标制作:MACD金叉 AND KDJ金叉 AND RSI金叉 AND LWR金叉 AND BBI金叉 AND MTM金叉,COLORRED,LINETHICK2;

选股公式:

DIFF := EMA(CLOSE,12) - EMA(CLOSE,26); DEA := EMA(DIFF,9); MACD_CROSS := DIFF > DEA; RSV := (CLOSE - LLV(LOW, 12)) / (HHV(HIGH, 12) - LLV(LOW, 12)) 100; K := SMA(RSV, 3, 1); D := SMA(K, 3, 1); KDJ_CROSS := K > D; LC := REF(CLOSE, 1); RSI1 := (SMA(MAX(CLOSE - LC, 0), 9, 1)) / (SMA(ABS(CLOSE - LC), 9, 1)) 100; RSI2 := (SMA(MAX(CLOSE - LC, 0), 26, 1)) / (SMA(ABS(CLOSE - LC), 26, 1)) 100; RSI_CROSS := RSI1 > RSI2; LWR1 := SMA(RSV, 3, 1); LWR2 := SMA(LWR1, 3, 1); LWR_CROSS := LWR1 > LWR2; BBI := (MA(CLOSE, 3) + MA(CLOSE, 9) + MA(CLOSE, 12) + MA(CLOSE, 26)) / 4; BBI_CROSS := CLOSE > BBI; MTM := CLOSE - REF(CLOSE, 1); MOMENTUM := 100 EMA(EMA(MTM, 9), 9) / EMA(EMA(ABS(MTM), 9), 3); CXHZB := 100 * EMA(EMA(MTM, 26), 12) / EMA(EMA(ABS(MTM), 26), 12); MTM_CROSS := MOMENTUM > CXHZB; G_SEARCH := MACD_CROSS AND KDJ_CROSS AND RSI_CROSS AND LWR_CROSS AND BBI_CROSS AND MTM_CROSS; G_SEARCH;