以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- [求助]后台交易 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=162741) |
-- 作者:qwer123 -- 发布时间:2018/4/13 9:59:27 -- [求助]后台交易 后台用的不很多,下面的编程能否满足我的要求?这是一种挂单交易方法。 有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能识别吗? |
-- 作者:wenarm -- 发布时间:2018/4/13 10:22:11 -- 1.可以,不过你手工挂单的操作需要在后台监控界面下进行处理。 因为这类函数都是读取的持仓监控记录中的信息进行判断的。 |