欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 关于后台持仓同步

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有2822人关注过本帖树形打印复制链接

主题:关于后台持仓同步

帅哥哟,离线,有人找我吗?
linanmeng
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:167 积分:81 威望:0 精华:0 注册:2010/5/20 16:35:09
关于后台持仓同步  发帖心情 Post By:2020/9/14 9:58:29    Post IP:76.1.182.144[显示全部帖子]

请教:以下代码,是阿火的后台持仓同步模版,前5行是否并不是后台用的模版?只是一个图表的开仓程序?
然后,程序中是指定账户下单,如何改成所有账户都能下单(用于机构版多账户)

cc:=holding;
if holding>0 and c<ref(c,1) then sell(1,1,market);
if holding<0 and c>ref(c,1) then sellshort(1,1,market);
if holding=0 and c>ref(c,1) then buy(1,1,market);
if holding=0 and c<ref(c,1) then buyshort(1,1,market);
if not(islastbar) or workmode<>1 then exit;
tm:=30;//撤单时间
ac:='800988';//下单账户
wt:=tremainqty(0,ac,stklabel);
buyhold:=tbuyholdingex(ac,stklabel,1);
sellhold:=tsellholdingex(ac,stklabel,1);
if wt>0.5 and tsubmit(0)>tm then tcancelex(1,0,ac,stklabel);//如果用软件自带的撤单功能,这句删除。
if wt<0.5 then begin
 kc1:=max(cc,0)-buyhold;
 kc2:=abs(min(cc,0))-sellhold;
 if kc1<-0.5 then tsell(1,abs(kc1),mkt,0,0,ac),allowrepeat;
 if kc2<-0.5 then tsellshort(1,abs(kc2),mkt,0,0,ac),allowrepeat;
 if sellhold<0.5 and kc1>0.5 then tbuy(1,kc1,mkt,0,0,ac),allowrepeat;
 if buyhold<0.5  and kc2>0.5 then tbuyshort(1,kc2,mkt,0,0,ac),allowrepeat;
end

 回到顶部
帅哥哟,离线,有人找我吗?
linanmeng
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:167 积分:81 威望:0 精华:0 注册:2010/5/20 16:35:09
  发帖心情 Post By:2020/9/14 10:53:43    Post IP:76.1.182.144[显示全部帖子]

关于2,因为后台程序里的语句是指定账户的,
比如:ac:='800988';//下单账户
wt:=tremainqty(0,ac,stklabel);
这些语句怎么改成所有账户的?我试着把第二句改成 wt:=tremainqty(0,stklabel);好像是报错!

 回到顶部