Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共10 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

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

1楼
DarthYoda 发表于:2012/7/25 12:13:35
只用在测试中,但不管用,麻烦大家指点一下,谢谢

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);
2楼
jinzhe 发表于:2012/7/25 13:21:03

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

改成

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

3楼
阿火 发表于: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);

4楼
DarthYoda 发表于:2012/7/25 18:11:31
以下是引用jinzhe在2012-7-25 13:21:03的发言:

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

改成

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

多谢,试过了,可用
5楼
DarthYoda 发表于:2012/7/25 18:13:07
以下是引用阿火在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楼
阿火 发表于:2012/7/26 8:51:21

你的顺序是错误的

 

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

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

[此贴子已经被作者于2012-7-26 8:51:50编辑过]
7楼
阿火 发表于:2012/7/26 8:54:22

另外,如果单单这样写

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

 

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

8楼
DarthYoda 发表于:2012/7/26 13:32:21
 非常感谢阿火,明白了
9楼
DarthYoda 发表于:2012/7/29 22:51:29
以下是引用阿火在2012-7-26 8:51:21的发言:

你的顺序是错误的

 

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

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

[此贴子已经被作者于2012-7-26 8:51:50编辑过]
老大帮我看看,升级2.90以后成未来函数了?
10楼
DarthYoda 发表于:2012/7/29 23:03:55
不好意思,是我搞错了
共10 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 0.04883 s, 3 queries.