以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 金字塔软件问题提交 (http://weistock.com/bbs/list.asp?boardid=2) ---- [求助]Tick周期上的同周期同时出现开平仓问题 (http://weistock.com/bbs/dispbbs.asp?boardid=2&id=2975) |
-- 作者:z7c9 -- 发布时间:2010/9/24 11:03:34 -- [求助]Tick周期上的同周期同时出现开平仓问题 le:=rand(2)=1; se:=rand(2)=2; buy(holding=0 and le,1,limitr,close); buyshort(holding=0 and se,1,limitr,close); 资产:asset,noaxis,colorred;
这段随机开仓,2跳止盈止损的策略,应用在Tick周期,为什么有大量的平仓都在当前bar,如图?
应用在其他周期也一样,有很多在当前bar平仓 |
-- 作者:admin -- 发布时间:2010/9/24 11:06:13 -- 这种情况说明你的开平仓策略在同一个周期满足,请使用TYPE函数对开平仓条件进行过滤 |
-- 作者:z7c9 -- 发布时间:2010/9/24 11:07:22 -- 以下是引用admin在2010-9-24 11:06:13的发言:
这种情况说明你的开平仓策略在同一个周期满足,请使用TYPE函数对开平仓条件进行过滤 平仓策略是:abs(enterprice-close)>=2*mindiff,怎么可能在同一个bar上满足这个条件? |
-- 作者:admin -- 发布时间:2010/9/24 11:09:27 -- 这种简单的问题,使用金字塔的调试技巧很容易就能查出问题的 金字塔公式编写调试 http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=1246&page=1&star=1 |
-- 作者:z7c9 -- 发布时间:2010/9/24 11:17:55 -- 以下是引用admin在2010-9-24 11:09:27的发言:
这种简单的问题,使用金字塔的调试技巧很容易就能查出问题的 金字塔公式编写调试 http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=1246&page=1&star=1 le:=rand(2)=1;
lx:=enterbars>0 and abs(enterprice-close)>=2*mindiff; se:=rand(2)=2; sx:=enterbars>0 and abs(enterprice-close)>=2*mindiff; buy(holding=0 and le,1,limitr,close); debugfile2(\'c:\\log.txt\',\'close=%.0f\',close,0); debugfile2(\'c:\\log.txt\',\'enterprice=%.0f\',enterprice,0); sell(holding>0 and lx,holding,limitr,close); buyshort(holding=0 and se,1,limitr,close); sellshort(holding<0 and sx,holding,limitr,close); 资产:asset,noaxis,colorred;
log.txt: enterprice=26395
close=26660 enterprice=26395 close=26665 enterprice=26395 close=26655 enterprice=26395 close=26660 enterprice=26395 close=26665 enterprice=26395 close=26665 enterprice=26395 close=26665 enterprice=26395 close=26665
所有的enterprice都等于26395,什么原因?
[此贴子已经被作者于2010-9-24 11:21:23编辑过]
|
-- 作者:admin -- 发布时间:2010/9/24 11:20:00 -- 图表交易的公式调试请用LINETHICK0控制符,请按照教程说的方法调试,不要自己乱想花样,再说你完全扭曲了DEBUFILE2函数的用法 [此贴子已经被作者于2010-9-24 11:20:36编辑过]
|
-- 作者:z7c9 -- 发布时间:2010/9/24 11:26:26 -- 以下是引用admin在2010-9-24 11:20:00的发言:
图表交易的公式调试请用LINETHICK0控制符,请按照教程说的方法调试,不要自己乱想花样,再说你完全扭曲了DEBUFILE2函数的用法 [此贴子已经被作者于2010-9-24 11:20:36编辑过] le:=rand(2)=1;
lx:abs(enterprice-close)>=2*mindiff,linethick0; se:=rand(2)=2; sx:abs(enterprice-close)>=2*mindiff,linethick0; buy(holding=0 and le,1,limitr,close); sell(holding>0 and lx,holding,limitr,close); buyshort(holding=0 and se,1,limitr,close); sellshort(holding<0 and sx,holding,limitr,close); 资产:asset,noaxis,colorred; 开仓价:enterprice,linethick0; 收盘价:close,linethick0;
明显不对呀,enterprice-close=0,abs(0)=0,怎么可能大于2*mindiff? [此贴子已经被作者于2010-9-24 11:30:53编辑过]
|
-- 作者:admin -- 发布时间:2010/9/24 11:50:07 -- le:=rand(2)=1; se:=rand(2)=2; buy(holding=0 and le,1,limitr,close); buyshort(holding=0 and se,1,limitr,close); 资产:asset,noaxis,colorred; |
-- 作者:z7c9 -- 发布时间:2010/9/24 11:57:14 -- 以下是引用admin在2010-9-24 11:50:07的发言:
le:=rand(2)=1; se:=rand(2)=2; buy(holding=0 and le,1,limitr,close); buyshort(holding=0 and se,1,limitr,close); 资产:asset,noaxis,colorred; 明白aa和bb的位置应该写在交易函数之前。如图,enterprice和close倒是对的上了,但是问题是明明在同一个Tick上开平仓的怎么会开仓的enterprice和平仓的close不一样呢? [此贴子已经被作者于2010-9-24 11:58:59编辑过]
|
-- 作者:admin -- 发布时间:2010/9/24 15:32:00 -- 建议你使用ENTERLONG交易系统。 |