后台用的不很多,下面的编程能否满足我的要求?这是一种挂单交易方法。 有4种信号:1平空开多AA;2平多开空BB;3止损平空开多CC;4止损平多开空DD; 1.当出现AA时,实际持仓>0,如果有平多开空挂单,撤掉挂单; 实际持仓<=0,平空开多; 2.当出现BB时,实际持仓<0,如果有平空开多的挂单,撤单; 实际持仓>=0 平多开空; 出现CC,DD,同AA,BB处理; //******************************** if AA then begin if tisremain(2)>0.5 then tcancel(1,2); if tisremain(3)>0.5 then tcancel(1,3); end if BB then begin if tisremain(4)>0.5 then tcancel(1,4); if tisremain(1)>0.5 then tcancel(1,1); end //******************************** if tholding2<=0 and AA then begin tsellshort(1,0,lmt,C-nn2),NOATTACK; tbuy(1,tn,lmt,C-nn2),NOATTACK; end if tholding2>=0 and BB then begin tsell(1,0,lmt,C+nn2),NOATTACK; tbuyshort(1,tn,C+nn2),NOATTACK; end //**************************** if tholding2<0 and CC then begin if tisremain(4)>0.5 then tcancel(1,4); if tisremain(1)>0.5 then tcancel(1,1); tsellshort(1,0,mkt); tbuy(1,tn,mkt); end if tholding2>0 and DD then begin if tisremain(2)>0.5 then tcancel(1,2); if tisremain(3)>0.5 then tcancel(1,3); tsell(1,0,mkt); tbuyshort(1,tn,mkt); end //***************************** 如果我手工挂单,tisremain能识别吗? |