DayVarValue1:ma(close,5);//
DayVarValue2:ma(close,10);
//开仓条件
DayIntervalValue:=DayVarValue1-DayVarValue2;
KD:=ref(low,1)<DayVarValue2 and ref(close,1)>=DayVarValue2 and date>=1120101 and time<=143000 ; //开多条件
//PD:=ref(close,1)>=(DayVarValue2+0.5*DayIntervalValue); //平多条件
PD:=(ref(close,1)>=(DayVarValue2+ratio*DayIntervalValue)) or (ref(close,1)<DayVarValue2 and ref(close,2)<DayVarValue2);
KK:=ref(high,1)>DayVarValue1 and ref(close,1)<DayVarValue1 and date>=1120101 and time<=143000; //开空条件
PK:=(ref(close,1)<=(DayVarValue1-0.5*DayIntervalValue)) or (ref(close,1)>DayVarValue1 and ref(close,2)>DayVarValue1); //平空条件
//PD:=(ref(close,1)>=(DayVarValue2+ratio*DayIntervalValue)) or (ref(close,1)<DayVarValue2 and ref(close,2)<DayVarValue2);
BUY(KD AND HOLDING=0,1,OPEN); //开多信号
SELL(HOLDING>0 AND PD,1,OPEN); //平多信号
BUYSHORT(KK AND HOLDING=0,1,OPEN); //开空信号
SELLSHORT(holding<0 AND PK,1,OPEN); //平空信号
if time>=150000 then begin
sell(holding>0,1,market);
sellshort(holding<0,1,market);
end
----------------------------------------------------
测试正常,为什么没信号出来?股指连续5min周期上
公式中下单函数的价位参数写错了
要么是buy(cond,vol,limitr,open);
要么是buy(cond,vol,market);
写成buy(cond,vol,open);是不对的