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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请教关于hans123加入止损止盈的改写

   

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


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

主题:请教关于hans123加入止损止盈的改写

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/5 16:03:08    Post IP:58.246.57.26[显示全部帖子]

处理中,请稍等


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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/5 16:33:20    Post IP:58.246.57.26[显示全部帖子]

 

//N1,N2,N3,N4可以自行定义

//适用周期一分钟

t1:=time>090000 and time<145500;
t2:=time>=145500;
shanggui:=valuewhen(todaybar<=30,hhv(h,todaybar));
xiagui:=valuewhen(todaybar<=30,llv(l,todaybar));

if h>shanggui and t1 then buy(holding=0,1,market);

if l<xiagui and t1 then buyshort(holding=0,1,market);

if c-enterprice>n1*mindiff and holding<0 then sellshort(1,0,market);//止损空头

if enterprice-c>n2*mindiff and holding>0 then sell(1,0,market);//止损多头

if c-enterprice>n3*mindiff and holding>0 then sell(1,0,market);//多头止盈

if enterprice-c>n4*mindiff and holding<0 then sellshort(1,0,market);//空头止盈

if t2 then BEGIN

   sellshort(1,0,market);
   sell(1,0,market);
end//收盘平仓



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 9:10:46    Post IP:58.246.57.26[显示全部帖子]

第一句,也就是input那句,最后少了一个分号
[此贴子已经被作者于2013/12/6 9:10:56编辑过]


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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 9:14:48    Post IP:58.246.57.26[显示全部帖子]

测评是做不到触发价的,只能是开高低收4个中的一个来编写,如果觉得收盘价不行,那么你改这个自己认为正确的价格

 

使用5分钟,把上面的

 

shanggui:=valuewhen(todaybar<=30,hhv(h,todaybar));
xiagui:=valuewhen(todaybar<=30,llv(l,todaybar));

 

改成

 

shanggui:=valuewhen(todaybar<=6,hhv(h,todaybar));
xiagui:=valuewhen(todaybar<=6,llv(l,todaybar));



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 13:34:52    Post IP:58.246.57.26[显示全部帖子]

//N1,N2,N3,N4可以自行定义

//适用周期一分钟

variable:n=0;

t1:=time>090000 and time<145500;
t2:=time>=145500;
shanggui:=valuewhen(todaybar<=30,hhv(h,todaybar));
xiagui:=valuewhen(todaybar<=30,llv(l,todaybar));

if h>shanggui and t1 and n=0 then buy(holding=0,1,market);

if l<xiagui and t1 then and n=0 buyshort(holding=0,1,market);

if c-enterprice>n1*mindiff and holding<0 then begin

n:=;

sellshort(1,0,market);//止损空头

end

if enterprice-c>n2*mindiff and holding>0 then begin

n:=1;

sell(1,0,market);//止损多头

end

if c-enterprice>n3*mindiff and holding>0 then sell(1,0,market);//多头止盈

if enterprice-c>n4*mindiff and holding<0 then sellshort(1,0,market);//空头止盈

if t2 then BEGIN

   sellshort(1,0,market);
   sell(1,0,market);

  
end//收盘平仓

if time=closetime(0) then n:=0;



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 14:29:43    Post IP:58.246.57.26[显示全部帖子]

//N1,N2,N3,N4可以自行定义

//适用周期一分钟

variable:n=0;

t1:=time>090000 and time<145500;
t2:=time>=145500;
shanggui:=valuewhen(todaybar<=30,hhv(h,todaybar));
xiagui:=valuewhen(todaybar<=30,llv(l,todaybar));

if h>shanggui and t1 and n=0 then buy(holding=0,1,market);

if l<xiagui and t1 then and n=0 buyshort(holding=0,1,market);

if c-enterprice>n1*mindiff and holding<0 then begin

n:=1;

sellshort(1,0,market);//止损空头

end

if enterprice-c>n2*mindiff and holding>0 then begin

n:=1;

sell(1,0,market);//止损多头

end

if c-enterprice>n3*mindiff and holding>0 then sell(1,0,market);//多头止盈

if enterprice-c>n4*mindiff and holding<0 then sellshort(1,0,market);//空头止盈

if t2 then BEGIN

   sellshort(1,0,market);
   sell(1,0,market);

  
end//收盘平仓

if time=closetime(0) then n:=0;



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 14:54:57    Post IP:58.246.57.26[显示全部帖子]

要收盘价突破才是?不是最低价?

还有说清楚,是要触发式的,还是要信号固定式的



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 15:13:35    Post IP:58.246.57.26[显示全部帖子]

触发时就是满足条件就下单,用图表交易的固定时间间隔模式,固定是就是图表交易的走完k线模式,不是代码编写

 

既然是要收盘价那么只要改掉上面的H和L就行

if h>shanggui and t1 and n=0 then buy(holding=0,1,market);

if l<xiagui and t1 then and n=0 buyshort(holding=0,1,market);

中的H,和L改成C

 

if c>shanggui and t1 and n=0 then buy(holding=0,1,market);

if c<xiagui and t1 then and n=0 buyshort(holding=0,1,market);



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 15:28:02    Post IP:58.246.57.26[显示全部帖子]

开盘前30分钟, 1分钟 是30个bar,而5分钟,不就是6个bar



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

客户服务部

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

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

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


加好友 发短信
等级:罗宾汉 帖子:46311 积分:50819 威望:0 精华:2 注册:2011/3/23 8:50:25
  发帖心情 Post By:2013/12/6 16:49:24    Post IP:58.246.57.26[显示全部帖子]

那么这4个都要改

if c-enterprice>n1*mindiff and holding<0 then sellshort(1,0,market);//止损空头

if enterprice-c>n2*mindiff and holding>0 then sell(1,0,market);//止损多头

if c-enterprice>n3*mindiff and holding>0 then sell(1,0,market);//多头止盈

if enterprice-c>n4*mindiff and holding<0 then sellshort(1,0,market);//空头止盈

 

 

修改方法前面已经写好,照着抄就行

 

if c-enterprice>n1*mindiff and holding<0 then begin

n:=1;

sellshort(1,0,market);//止损空头

end

if enterprice-c>n2*mindiff and holding>0 then begin

n:=1;

sell(1,0,market);//止损多头

end

 

多加一个n:=1;的赋值,要用begin来限定

[此贴子已经被作者于2013/12/6 16:50:19编辑过]


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

客户服务部

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

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

 回到顶部
总数 11 1 2 下一页