以下策略为金字塔程序化双边策略(可开多,可开空),请老师更改为两个单边策略(只开空一个策略,只开多一个策略),谢谢
//该策略适用于图表程序化交易
//该范例适用于5分钟周期
//此策略仅供参考学习,请勿直接用于实盘
INPUT:N(55,1,100,1),SS(1,1,100,1),NMIN(10,1,100,1),LONG_CO(0.999,0.001,1.1,0.001),SHORT_CO(1.001,0.001,1.1,0.001);
BUYTIME:=TIME>OPENTIME(1) AND TIME<CLOSETIME(0)-NMIN*100; //设置日内交易的开仓时段
SELLTIME:=TIME>=CLOSETIME(0)-NMIN*100; //设置尾盘的清仓时段
UP_LINE:REF(HHV(H,N),1)*LONG_CO; //设置上轨线
DOWN_LINE:REF(LLV(L,N),1)*SHORT_CO; //设置下轨线
MIDDLE_LINE:(UP_LINE+DOWN_LINE)/2; //设置中轨线
CONKD:H>=UP_LINE AND BUYTIME ; //设置开多条件
CONKK:L<=DOWN_LINE AND BUYTIME; //设置开空条件
CONPD:C<MIDDLE_LINE; //设置平多条件
CONPK:C>MIDDLE_LINE; //设置平空条件
SELLSHORT(CONPK AND HOLDING<0,HOLDING,MARKET);
SELL(CONPD AND HOLDING>0,HOLDING,MARKET);
BUY(CONKD AND HOLDING=0,SS,MARKET);
BUYSHORT(CONKK AND HOLDING=0,SS,MARKET);
IF SELLTIME THEN //收盘前全部平仓
BEGIN
SELL(HOLDING>0,HOLDING,MARKET);
SELLSHORT(HOLDING<0,HOLDING,MARKET);
END