//—-参数设置—-
N:=20; //布林线周期
M:=14; //KDJ周期
MACD_S:=12; //MACD短周期
MACD_L:=26; //MACD长周期
MACD_M:=9; //MACD信号周期
CORR_PERIOD:=30;//跨品种相关性周期
//—-基础指标—-
BOLL_MID:MA(CLOSE,N);
BOLL_UPPER:BOLL_MID+2*STD(CLOSE,N);
BOLL_LOWER:BOLL_MID-2*STD(CLOSE,N);
RSV:=(CLOSE-LLV(LOW,M))/(HHV(HIGH,M)-LLV(LOW,M))*100;
K:SMA(RSV,3,1),COLORWHITE;
D:SMA(K,3,1),COLORYELLOW;
J:3*K-2*D,COLORMAGENTA;
DIFF:EMA(CLOSE,MACD_S)-EMA(CLOSE,MACD_L),COLORRED;
DEA:EMA(DIFF,MACD_M),COLORBLUE;
MACD:(DIFF-DEA)*2,COLORSTICK;
//—-盘口大单监控—-
BIG_ORDER:=VOL>REF(MA(VOL,5),1)*1.5 &&
(CLOSE-OPEN)/(HIGH-LOW)>0.7 &&
TIME>0900 && TIME<1455;
//—-MACD柱状线背离—-
MACD_DIVERGENCE_LONG:= C<REF(LLV(C,5),1) && MACD>REF(MACD,1);
MACD_DIVERGENCE_SHORT:= C>REF(HHV(C,5),1) && MACD<REF(MACD,1);
//—-分时成交量分布—-
VOL_DISTRIBUTE:= SUM(VOL,BARSLAST(TIME=0900))>REF(SUM(VOL,30),1)*0.8 &&
VOL>MA(VOL,5)*1.3 &&
VOL>REF(HHV(VOL,5),1);
//—-跨品种相关性验证—-
PP_CLOSE:= “PP8888$CLOSE”; //关联PP主力合约
CRUDE_OIL:= “SC8888$CLOSE”; //关联原油主力
CORR_PP:= CORR(C,PP_CLOSE,CORR_PERIOD);
CORR_OIL:= CORR(C,CRUDE_OIL,CORR_PERIOD);
//—-复合开仓条件—-
LONG_SIGNAL:
//核心条件
C>BOLL_LOWER AND REF(C,1)<BOLL_LOWER AND
J<20 AND REF(J,1)<20 AND
EMA(C,5)>EMA(C,20) AND
//增强过滤
MACD_DIVERGENCE_LONG AND
VOL_DISTRIBUTE AND
BIG_ORDER AND
CORR_PP>0.7 AND CORR_OIL<-0.6 AND //品种联动验证
(CLOSE-OPEN)/(HIGH-LOW)>0.6 AND
DMI.ADX<25;
SHORT_SIGNAL:
C<BOLL_UPPER AND REF(C,1)>BOLL_UPPER AND
J>80 AND REF(J,1)>80 AND
EMA(C,5)<EMA(C,20) AND
MACD_DIVERGENCE_SHORT AND
VOL_DISTRIBUTE AND
BIG_ORDER AND
CORR_PP<-0.7 AND CORR_OIL>0.6 AND
(OPEN-CLOSE)/(HIGH-LOW)>0.6 AND
DMI.ADX<25;
//—-信号提示—-
DRAWICON(LONG_SIGNAL,LOW,1),COLORRED;
DRAWICON(SHORT_SIGNAL,HIGH,2),COLORGREEN;
ALERT(LONG_SIGNAL OR SHORT_SIGNAL,”★超级信号★”,1);
//—-资金管理—-
SET_STOPLOSS(15*MINPRICE); //15点止损
SET_PROFIT(23*MINPRICE); //23点止盈(1:1.53)
AUTOFILTER; //信号过滤