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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 后台下单模板

   

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


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

主题:后台下单模板

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


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
后台下单模板  发帖心情 Post By:2020/2/12 18:22:04    Post IP:122.97.222.140[显示全部帖子]

请问下面是实例中为什么已经有了sell, sellshort, buy, buyshort语句, 还要增加 tsellshort(1,cang,mkt,0,0,'800988'),allowrepeat;  tbuyshort(1,cang,mkt,0,0,'800988'),allowrepeat; 干嘛? 

另外xiadan800988:=cc800988-hold;cang:=min(xiadan800988,abs(hold));这两句分别是什么意思? 下了多少手成交和未成交实际上不是用tholding或者tholdingex来实现吗? 为什么要那么麻烦? 


实例见此贴 http://www.weistock.com/bbs/dispbbs.asp?BoardID=10&ID=9112&replyID=&skin=1

//实例一、 K线走完模式的模型

Globalvariable:hold=drawnull;
cc800988:=holding;//这句放在信号稳定的地方

//蓝色部分改为你自己的模型(K线走完模型)
buycond:=count(c>o,2)=2;
sellcond:=count(c<o,2)=2;
if holding>0 and sellcond then sell(1,1,thisclose);
if holding<0 and buycond then sellshort(1,1,thisclose);
if holding=0 and buycond then buy(1,1,thisclose);
if holding=0 and sellcond then buyshort(1,1,thisclose);

drawtextex(1,1,800,0,'虚拟持仓为:'+numtostr(cc800988,0));//在图表上输入虚拟持仓以便监控
if not(islastbar) or workmode<>1 then exit;
xiadan800988:=cc800988-hold;//xiadan800988等于持仓
if xiadan800988>0.5 then begin//如果有下单的话
 cang:=min(xiadan800988,abs(hold));//cang 的意思是仓位
 if hold<0 then begin
  tsellshort(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 平空 %.0f',cang);
 end
 cang:=xiadan800988+min(hold,0);
 if cang>0 then begin
  tbuy(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 开多 %.0f',cang);
 end
end
if xiadan800988<-0.5 then begin
 cang:=min(abs(xiadan800988),abs(hold));
 if hold>0 then begin
  tsell(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 平多 %.0f',cang);
 end
 cang:=abs(xiadan800988)-max(hold,0);
 if cang>0 then begin
  tbuyshort(1,cang,mkt,0,0,'800988'),allowrepeat;
  debugfile('D:\800988.txt',numtostr(hold,0)+' '+numtostr(cc800988,0)+' 开空 %.0f',cang);
 end
end
hold:=cc800988;

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


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2020/2/13 9:07:43    Post IP:122.97.179.3[显示全部帖子]

请问下面是实例中为什么已经有了sell, sellshort, buy, buyshort语句, 还要增加 tsellshort(1,cang,mkt,0,0,'800988'),allowrepeat;  tbuyshort(1,cang,mkt,0,0,'800988'),allowrepeat; 主要是怕交易不成功, 重新再发出指令?

另外xiadan800988:=cc800988-hold;cang:=min(xiadan800988,abs(hold));这两句分别是什么意思? 下了多少手成交和未成交实际上不是用tholding或者tholdingex来实现吗? 为什么要那么麻烦? 

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


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2020/2/13 11:53:54    Post IP:122.97.179.3[显示全部帖子]

看不懂里面的hold 代表的是什么意思, hold=drawnull并没有拿到实际的下单持仓。 如果计算剩下还有多少单没有下的话, 不是直接用holding-tholding 就可以了吗? 

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


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2020/2/13 13:13:27    Post IP:122.97.179.3[显示全部帖子]

hold在上面的程序 代表的是什么意思?跟cc800988又有什么区别?  hold=drawnull并没有拿到实际的下单持仓?

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


加好友 发短信
等级:论坛游侠 帖子:289 积分:0 威望:0 精华:0 注册:2019/4/29 11:42:41
  发帖心情 Post By:2020/2/13 18:34:22    Post IP:112.96.179.193[显示全部帖子]

这里的 cang主要用来干什么的,主要代表什么意思? 为什么在不同if会要求 cang:=min(xiadan800988,abs(hold)); 和 cang:=xiadan800988+min(hold,0); ?

 回到顶部