后台交易程序:
1)当下持仓为多单100手,空单100手,对锁中。价位3130;
2)若上涨1个点位要求系统减仓5手空单,上涨3个点位要求系统自动减仓5手多单。这样的循环;
3)若下跌1个点位要求系统自动减仓5手多单,下跌3个点位要求系统自动减仓5手空单,这样的循环。
4)一直到减仓完毕。
5)挂单后40秒不成交自动撤单,并且当下价位直接平掉单腿。要求持仓同步。
-----若上涨1个点位要求系统减仓5手空单,上涨3个点位要求系统自动减仓5手多单。这样的循环;
多空点差保持2点的意思;
就是说比如:当下持仓为多单100手,空单100手,对锁中。价位3130;
3231减空单5手,涨到3233减多单5手;
3234减空单5手,涨到3236减多单5手;
3237减空单5手,涨到3239减多单5手;
多空点差保持2点的这样循环
variable:n=1;
if (TIME>=085600 AND TIME<=90000) then begin
tbuy(1,10,lmt,DYNAINFO(54),0);
tbuyshort(1,10,lmt,DYNAINFO(55),0);
end
if THOLDING2<0 and (time<145000) then begin
tbuy(val2>0,10,lmt,o,0);
tbuyshort(val2>0,10,lmt,o,0);
end
et1:=TAVGENTERPRICEEX2('' , '', 0);//多头持仓均价
et2:=TAVGENTERPRICEEX2('' , '', 1);//空头持仓均价
if THOLDING2>0 then begin
n:=n+1;
end
if mod(open-(et2+1),2)=0 then tsellshort(1,1,lmt,et2+1,0);
if mod(open-(et1+2),2)=0 then tsell(1,1,lmt,et1+2,0);
if mod(open-(et2+n),2)=0 then tsellshort(1,1,lmt,(et2+n),0);
if mod(open-((et1+n)+1),2)=0 then tsell(1,1,lmt,((et1+n)+1),0);
if mod((et1-1)-open,2)=0 then tsell(1,1,lmt,et1-1,0);
if mod((et2-2)-open,2)=0 then tsellshort(1,1,lmt,et2-2,0);
if mod((et1-n)-open,2)=0 then tsell(1,1,lmt,(et1-n),0);
if mod(((et2-n)-1)-open,2)=0 then tsellshort(1,1,lmt,(et2-n)-1,0);
//撤单
tm:=50;//撤单时间秒
if tisremain(0)>0 and tsubmit(0)>tm then begin
tcancel(1,0);
end
tsell(1,1,mkt);
tsellshort(1,1,mkt);
//收盘平仓
if CURRENTTIME>=151300 and currenttime<=151400 then begin
tsell(1,0,mkt);
tsellshort(1,0,mkt);
end
要求这样循环的.
初始第一次平空为et2+1,当第二次平空是(et2+1)+1,继续循环时,以此类推。
初始第一次平多为 et1+2,,当第二次平多是 (et1+2)+1,继续循环时,以此类推。
[此贴子已经被作者于2014/5/21 23:30:12编辑过]