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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 请教固定止盈止损模型写法

   

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


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

主题:请教固定止盈止损模型写法

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


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
请教固定止盈止损模型写法  发帖心情 Post By:2013/3/25 10:49:27    Post IP:222.210.88.152[只看该作者]

请教一下,在下面的模型中,增加固定n点止盈和固定n1点止损,该怎么添加呀。

hi:=ref(hhv(h,x),1);
lo:=ref(llv(l,x),1);
if cc2>0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc2:=0;
end
if cc2<0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc2:=0;
end
if cc2=0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc2:=1;
end
if cc2=0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc2:=-1;
end



查看使用道具详细信息
悬赏金币帖,要悬赏 1 个金币
 回到顶部
帅哥哟,离线,有人找我吗?
just
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:金字塔养老院 帖子:1323 积分:6764 威望:0 精华:0 注册:2011/6/14 17:27:11
  发帖心情 Post By:2013/3/25 11:14:47    Post IP:58.246.57.26[只看该作者]

工作人员在处理,请稍后


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

客户服务部

-----------------------------------------------------------

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

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com
获得0个金币
 回到顶部
帅哥哟,离线,有人找我吗?
bizstar
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
  发帖心情 Post By:2013/3/25 11:22:01    Post IP:222.210.88.152[只看该作者]

谢谢。

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


加好友 发短信
等级:金字塔养老院 帖子:1323 积分:6764 威望:0 精华:0 注册:2011/6/14 17:27:11
  发帖心情 Post By:2013/3/25 11:22:30    Post IP:58.246.57.26[只看该作者]


hi:=ref(hhv(h,x),1);
lo:=ref(llv(l,x),1);

if holding>0 and enterprice-close>n then sell(1,1,market);
if holding<0 and close-enterprice<n1 then sellshort(1,1,market);
if cc2>0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc2:=0;
end
if cc2<0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc2:=0;
end
if cc2=0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
 cc2:=1;
end
if cc2=0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
 cc2:=-1;
end

[此贴子已经被作者于2013-3-25 11:22:42编辑过]


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

客户服务部

-----------------------------------------------------------

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

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com
获得1个金币
 回到顶部
帅哥哟,离线,有人找我吗?
bizstar
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
  发帖心情 Post By:2013/3/25 11:33:28    Post IP:222.210.88.152[只看该作者]

我这个策略上面还有个模型1,2个要同时存在,用holding可以吗

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


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
  发帖心情 Post By:2013/3/25 11:33:58    Post IP:222.210.88.152[只看该作者]

而且开仓价格也不能那么写吧。

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


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
  发帖心情 Post By:2013/3/25 12:20:42    Post IP:222.210.88.152[只看该作者]

这么写是否可以呢?

hi:=ref(hhv(h,x),1);
lo:=ref(llv(l,x),1);

if cang2>0 and zs-close>n1 then sell(1,1,limitr,zs-n1);
if cang2>0 and close-zs>n then  sell(1,1,limitr, zs+n);
if cang2<0 and close-zs<n1 then sellshort(1,1,limitr,zs+n1);
if cang2>0 and close-zs>n then sellshort(1,1,limitr,zs-n);
 
if cc2>0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
zs:=c;
 cc2:=0;
end
if cc2<0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
zs:=c;
 cc2:=0;
end
if cc2=0 and h>hi then begin
 pc:=min(abs(min(holding,0)),cang2);
 kc:=cang2-pc;
 if pc>0 then sellshort(1,pc,limitr,max(o,hi+0.2)+0.6);
 if kc>0 then buy(1,kc,limitr,max(o,hi+0.2)+0.6);
zs:=c;
 cc2:=1;
end
if cc2=0 and l<lo then begin
 pc:=min(max(holding,0),cang2);
 kc:=cang2-pc;
 if pc>0 then sell(1,pc,limitr,min(o,lo-0.2)-0.6);
 if kc>0 then buyshort(1,kc,limitr,min(o,lo-0.2)-0.6);
zs:=c;
 cc2:=-1;
end

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


加好友 发短信
等级:金字塔养老院 帖子:1323 积分:6764 威望:0 精华:0 注册:2011/6/14 17:27:11
  发帖心情 Post By:2013/3/25 13:34:54    Post IP:58.246.57.26[只看该作者]

由于我不清楚你某些变量的含义 故只能给你写个大概的意思 
[此贴子已经被作者于2013-3-25 13:35:08编辑过]


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

客户服务部

-----------------------------------------------------------

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

您的宝贵建议或者投诉,请发往邮箱:weiwei@weistock.com
获得0个金币
 回到顶部
帅哥哟,离线,有人找我吗?
bizstar
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:新手上路 帖子:40 积分:205 威望:0 精华:0 注册:2013/3/20 12:30:44
  发帖心情 Post By:2013/3/25 13:44:36    Post IP:222.210.88.152[只看该作者]

还是谢谢,已经支付悬赏。希望能和你进一步交流

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


加好友 发短信
等级:新手上路 帖子:3 积分:0 威望:0 精华:0 注册:2014/9/2 11:13:50
  发帖心情 Post By:2014/9/2 15:14:48    Post IP:175.42.17.186[只看该作者]

怎么在模型中写入固定止损和止盈

 


获得0个金币
 回到顶部