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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 每涨5%就卖出20%的仓位,怎么写

   

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


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

主题:每涨5%就卖出20%的仓位,怎么写

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


加好友 发短信
等级:论坛游侠 帖子:159 积分:0 威望:0 精华:0 注册:2014/10/23 15:05:10
每涨5%就卖出20%的仓位,怎么写  发帖心情 Post By:2016/12/9 9:44:48    Post IP:183.26.161.194[只看该作者]

请问下,图表程序化模型,相对于首次开仓价,每涨5%就卖出20%的原始多单仓位,这个应该怎么写呢?

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


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

一共平5次吗?


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

客户服务部

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

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

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


加好友 发短信
等级:论坛游侠 帖子:159 积分:0 威望:0 精华:0 注册:2014/10/23 15:05:10
  发帖心情 Post By:2016/12/9 13:12:58    Post IP:183.26.161.194[只看该作者]

这个例子里边最多就平5次

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


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

if 开仓条件 and holding=0 then begin

   buy(1,100,marketr);

   cc:=holding;

end

 

if c>=enterprice*1.05 and c<enterprice>1.1 then sell(1,cc*0.2,marketr);

if c>=enterprice*1.1 and c<enterprice>1.15 then sell(1,cc*0.2,marketr);

if c>=enterprice*1.15 and c<enterprice>1.2 then sell(1,cc*0.2,marketr);

if c>=enterprice*1.2 and c<enterprice>1.25 then sell(1,cc*0.2,marketr);

if c>=enterprice*1.30 then sell(1,0,marketr);



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

客户服务部

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

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

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


加好友 发短信
等级:论坛游侠 帖子:159 积分:0 威望:0 精华:0 注册:2014/10/23 15:05:10
  发帖心情 Post By:2016/12/9 16:41:25    Post IP:183.26.161.194[只看该作者]

这样写不合理吧,如果我连续几根K线都处于1.05*ENTERPRICEI和1.1*ENTERPRICE之间,那也会不断平仓的哦,我是想涨了5%平一次,后边再涨5%才平第二次10%

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


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

variable:n=0;

if 开仓条件 and holding=0 then begin

   buy(1,100,marketr);

   cc:=holding;

   n:=0;

end

 

if c>=enterprice*1.05 and c<enterprice>1.1 and n=0 and holding>0 then begin

  n:=1;

  sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.1 and c<enterprice>1.15 and n=1 and holding>0 then begin

  n:=2;

  sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.15 and c<enterprice>1.2 and n=2 and holding>0 then begin

  n:=3;

  sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.2 and c<enterprice>1.25 and n=3 and holding>0 then begin

   n:=4;

   sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.30 and n=4 then begin

   n:=5;

   sell(1,0,marketr);

end




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

客户服务部

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

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

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


加好友 发短信
等级:标准版用户 帖子:56 积分:0 威望:0 精华:0 注册:2014/12/4 23:22:31
  发帖心情 Post By:2018/6/17 21:43:24    Post IP:120.34.10.210[只看该作者]

以下是引用jinzhe在2016/12/9 16:45:18的发言:

variable:n=0;

if 开仓条件 and holding=0 then begin

   buy(1,100,marketr);

   cc:=holding;

   n:=0;

end

 

if c>=enterprice*1.05 and c<enterprice>1.1 and n=0 and holding>0 then begin

  n:=1;

  sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.1 and c<enterprice>1.15 and n=1 and holding>0 then begin

  n:=2;

  sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.15 and c<enterprice>1.2 and n=2 and holding>0 then begin

  n:=3;

  sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.2 and c<enterprice>1.25 and n=3 and holding>0 then begin

   n:=4;

   sell(1,cc*0.2,marketr);

end

if c>=enterprice*1.30 and n=4 then begin

   n:=5;

   sell(1,0,marketr);

end

 
倒数第2句,sell,仓位应该还是cc*0.2吧。
倒数第3句,可以取消。


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


加好友 发短信
等级:超级版主 帖子:14496 积分:0 威望:0 精华:0 注册:2017/7/4 13:40:18
  发帖心情 Post By:2018/6/19 9:30:18    Post IP:180.169.30.6[只看该作者]

 因为例子说了最多平五次,因此最后一次直接全平了。


命数如织,当如磐石。
 回到顶部