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


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → 大家帮忙看看,止损语句没起作用

   

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


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

主题:大家帮忙看看,止损语句没起作用

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


加好友 发短信
等级:黑侠 帖子:705 积分:2044 威望:0 精华:0 注册:2012/7/14 20:10:28
我的一个策略  发帖心情 Post By:2012/7/25 12:13:35    Post IP:110.178.32.152[只看该作者]

只用在测试中,但不管用,麻烦大家指点一下,谢谢

if holding=0 and 开多 then buy(1,1,thisclose);
if L<enterprice-30*mindiff then sell(holding>0,0,enterprice-30*mindiff);//30跳止损
if holding>0 and 平多 then sell(1,1,thisclose);

if holding=0 and 开空 then buyshort(1,1,thisclose);
if H>enterprice+30*mindiff then sellshort(holding<0,0,enterprice+30*mindiff);//止损
if holding<0 and 平空 then sellshort(1,1,thisclose);

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


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

sell(holding>0,0,enterprice-30*mindiff);

改成

sell(holding>0,0,limitr,enterprice-30*mindiff);



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

客户服务部

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

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

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


加好友 发短信 原leevolvo
等级:版主 帖子:2160 积分:10563 威望:0 精华:11 注册:2010/11/3 11:21:19
  发帖心情 Post By:2012/7/25 13:22:49    Post IP:120.42.45.130[只看该作者]

if L<enterprice-30*mindiff then sell(holding>0,0,limitr,min(o,enterprice-30*mindiff));//30跳止损
if holding>0 and 平多 then sell(1,1,thisclose);

if holding=0 and 开多 then buy(1,1,thisclose);


if H>enterprice+30*mindiff then sellshort(holding<0,0,limitr,max(o,enterprice+30*mindiff));//止损
if holding<0 and 平空 then sellshort(1,1,thisclose);
if holding=0 and 开空 then buyshort(1,1,thisclose);


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


加好友 发短信
等级:黑侠 帖子:705 积分:2044 威望:0 精华:0 注册:2012/7/14 20:10:28
  发帖心情 Post By:2012/7/25 18:11:31    Post IP:110.178.6.192[只看该作者]

以下是引用jinzhe在2012-7-25 13:21:03的发言:

sell(holding>0,0,enterprice-30*mindiff);

改成

sell(holding>0,0,limitr,enterprice-30*mindiff);

多谢,试过了,可用

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


加好友 发短信
等级:黑侠 帖子:705 积分:2044 威望:0 精华:0 注册:2012/7/14 20:10:28
  发帖心情 Post By:2012/7/25 18:13:07    Post IP:110.178.6.192[只看该作者]

以下是引用阿火在2012-7-25 13:22:49的发言:

if L<enterprice-30*mindiff then sell(holding>0,0,limitr,min(o,enterprice-30*mindiff));//30跳止损
if holding>0 and 平多 then sell(1,1,thisclose);

if holding=0 and 开多 then buy(1,1,thisclose);


if H>enterprice+30*mindiff then sellshort(holding<0,0,limitr,max(o,enterprice+30*mindiff));//止损
if holding<0 and 平空 then sellshort(1,1,thisclose);
if holding=0 and 开空 then buyshort(1,1,thisclose);

多谢,这个也可用,但是有一点不解,上面几个语句难道不要逻辑顺序吗? 我读下来怎么是反的啊?但是结果对

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


加好友 发短信 原leevolvo
等级:版主 帖子:2160 积分:10563 威望:0 精华:11 注册:2010/11/3 11:21:19
  发帖心情 Post By:2012/7/26 8:51:21    Post IP:120.42.45.130[只看该作者]

你的顺序是错误的

 

开空的位置是在close ,此时K线已经走完。接下来再用low来判断是否止损,就错了,具有隐性未来函数。

所以,要等到下一根才判断止损,放到开仓语句的前面也是这个作用

[此贴子已经被作者于2012-7-26 8:51:50编辑过]

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


加好友 发短信 原leevolvo
等级:版主 帖子:2160 积分:10563 威望:0 精华:11 注册:2010/11/3 11:21:19
  发帖心情 Post By:2012/7/26 8:54:22    Post IP:120.42.45.130[只看该作者]

另外,如果单单这样写

sell(holding>0,0,limitr,enterprice-30*mindiff);

 

也有点问题。如果触发止损的K线跳空低开触发止损后一路下行,此时以enterprice-30*mindiff下单是无法成交的。所以需要和K线的open做个比较


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


加好友 发短信
等级:黑侠 帖子:705 积分:2044 威望:0 精华:0 注册:2012/7/14 20:10:28
  发帖心情 Post By:2012/7/26 13:32:21    Post IP:110.178.48.222[只看该作者]

 非常感谢阿火,明白了

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


加好友 发短信
等级:黑侠 帖子:705 积分:2044 威望:0 精华:0 注册:2012/7/14 20:10:28
  发帖心情 Post By:2012/7/29 22:51:29    Post IP:110.178.16.80[只看该作者]

以下是引用阿火在2012-7-26 8:51:21的发言:

你的顺序是错误的

 

开空的位置是在close ,此时K线已经走完。接下来再用low来判断是否止损,就错了,具有隐性未来函数。

所以,要等到下一根才判断止损,放到开仓语句的前面也是这个作用

[此贴子已经被作者于2012-7-26 8:51:50编辑过]
老大帮我看看,升级2.90以后成未来函数了?

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


加好友 发短信
等级:黑侠 帖子:705 积分:2044 威望:0 精华:0 注册:2012/7/14 20:10:28
  发帖心情 Post By:2012/7/29 23:03:55    Post IP:110.178.16.80[只看该作者]

不好意思,是我搞错了

 回到顶部