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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 为什么会开平同时下单,老师看下

   

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


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

主题:为什么会开平同时下单,老师看下

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


加好友 发短信
等级:新手上路 帖子:45 积分:0 威望:0 精华:0 注册:2013/7/27 11:26:59
为什么会开平同时下单,老师看下  发帖心情 Post By:2016/7/11 9:28:14    Post IP:115.214.236.247[只看该作者]

多头止盈:=h>ref(close,enterbars)*1.005 and enterbars>1;
多头止损:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止盈:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止损:=h>ref(close,enterbars)*1.005 and enterbars>1;
//********************交易系统*****提前n秒下单*******************************
input:tq(5,3,60,1);//定义变量
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin
  if holding=0 and 开多 then buy(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding=0 and 开空 then buyshort(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding>0 and 多头止损 then sell(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding<0 and 空头止损 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;
end

//***************************提前n秒下单**********************************
if abb then begin
  if holding>0 and 多头止盈 then sell(1,1,thisclose),ignorecheckprice,orderqueue;//多头平仓
  if holding<0 and 空头止盈 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;//空头平仓
end



图片点击可在新窗口打开查看此主题相关图片如下:2016-07-11_092649.png
图片点击可在新窗口打开查看


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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2016/7/11 9:35:39    Post IP:180.173.43.114[只看该作者]

因为k线图上同时出了开和平的信号,说明此时开平条件是同时满足的


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

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


加好友 发短信
等级:新手上路 帖子:45 积分:0 威望:0 精华:0 注册:2013/7/27 11:26:59
  发帖心情 Post By:2016/7/11 9:44:39    Post IP:115.214.236.247[只看该作者]

止损、止盈要开仓后波动0.5%并且要走一根K线以后,怎么可能同时开平呢

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2016/7/11 9:47:30    Post IP:180.169.30.6[只看该作者]

因为代码里面的enterbars判断是写在开仓之前的,所以止损判断里面就变成了判断上一次开仓的周期而不是现在开仓的周期

 

直接把开仓周期判断,写在平仓语句里面,不要提前写



金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

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


加好友 发短信
等级:新手上路 帖子:45 积分:0 威望:0 精华:0 注册:2013/7/27 11:26:59
  发帖心情 Post By:2016/7/11 9:55:50    Post IP:115.214.236.247[只看该作者]

在改成这样才行吗?
多头止盈:=h>ref(close,enterbars)*1.005;
多头止损:=l<ref(close,enterbars)*0.995;
空头止盈:=l<ref(close,enterbars)*0.995;
空头止损:=h>ref(close,enterbars)*1.005;

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2016/7/11 10:03:24    Post IP:180.169.30.6[只看该作者]

多头止盈:=h>ref(close,enterbars)*1.005 and enterbars>1;
多头止损:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止盈:=l<ref(close,enterbars)*0.995 and enterbars>1;
空头止损:=h>ref(close,enterbars)*1.005 and enterbars>1;
//********************交易系统*****提前n秒下单*******************************
input:tq(5,3,60,1);//定义变量
abb:=(time0-timetot0(dynainfo(207))<=tq) or not(islastbar);
if abb then begin
  if holding=0 and 开多 then buy(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding=0 and 开空 then buyshort(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding>0 and 多头止损 and enterbars>1 then sell(1,1,thisclose),ignorecheckprice,orderqueue;
  if holding<0 and 空头止损 and enterbars>1 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;
end

//***************************提前n秒下单**********************************
if abb then begin
  if holding>0 and 多头止盈 and enterbars>1 then sell(1,1,thisclose),ignorecheckprice,orderqueue;//多头平仓
  if holding<0 and 空头止盈 and enterbars>1 then sellshort(1,1,thisclose),ignorecheckprice,orderqueue;//空头平仓
end


金字塔—专业程序化交易量化投资平台

客户服务部

----------------------------------------------------------- 欢迎您参加我公司的技术培训,具体培训需求请发邮件到service@weistock.com

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com

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


加好友 发短信
等级:新手上路 帖子:45 积分:0 威望:0 精华:0 注册:2013/7/27 11:26:59
  发帖心情 Post By:2016/7/11 10:06:35    Post IP:115.214.236.247[只看该作者]

多谢,测试

 回到顶部