//1.平空
if kp then begin
kp(kp1):sellshort(holding<0,ss,marketr);//
end
//2.开多
if kd2 and kd2<>dp then begin
kd(kd2):buy( holding=0,ss,limitr,kdx2);//
end
if kd1 and kd1<>dp then begin
kd(kd1):buy( holding=0,ss,limitr,kdx);//
end
//3.平多
if dp then begin
dp(dp1):sell(holding>0,ss,marketr);//
end
//4.开空
if kk2 and kk2<>kp then begin
kk(kk2):buyshort(holding=0,ss,limitr,kkx2);//
end
if kk1 and kk1<>kp then begin
kk(kk1):buyshort(holding=0,ss,limitr,kkx);//
end