按照你电话中的描述,范例如下:
INPUT:N1(5,1,500,1),N2(10,1,500,1),N3(20,1,500,1),N4(60,1,500,1);
MA5:MA(C,N1);
MA10:MA(C,N2);
MA20:MA(C,N3);
MA60:MA(C,N4);
JC_BIG:CROSS(MA20,MA60);
SC_BIG:CROSS(MA60,MA20);
JC_SMALL:CROSS(MA5,MA10);
SC_SMALL:CROSS(MA10,MA5);
IF JC_BIG THEN BEGIN
SELLSHORT(HOLDING<0,HOLDING,MARKET);
BUY(1,1,MARKET);
END
IF SC_BIG THEN BEGIN
SELL(HOLDING>0,HOLDING,MARKET);
BUYSHORT(1,1,MARKET);
END
IF BARSLAST(JC_BIG)<BARSLAST(SC_BIG) THEN BEGIN //大周期上的金叉后做多单
SELL(SC_SMALL AND HOLDING>0,HOLDING,MARKET);
BUY(JC_SMALL,1,MARKET);
END
IF BARSLAST(JC_BIG)>BARSLAST(SC_BIG) THEN BEGIN //大周期上的死叉后做空单
SELLSHORT(SC_SMALL AND HOLDING<0,HOLDING,MARKET);
BUYSHORT(JC_SMALL,1,MARKET);
END