以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://www.weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://www.weistock.com/bbs/list.asp?boardid=4) ---- [求助]为何改用IF语句后测试结果不一样? (http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=30479) |
-- 作者:烟圈 -- 发布时间:2012/11/8 8:36:34 -- [求助]为何改用IF语句后测试结果不一样? {开多} ENTERLONG:Z>0 ,TFILTER; {平多}EXITLONG:Z<0 ,TFILTER; {开空}ENTERSHORT:Z<0 ,TFILTER; {平空}EXITSHORT:Z>0 ,TFILTER; a:=z>0; b:=z<0; if holding<0 and a then begin sellshort(1,0,nextopen); buy(1,1,nextopen); end if holding>0 and b then begin sell(1,0,nextopen); buyshort(1,1,nextopen); end if holding=0 and a then buy(1,1,nextopen); if holding=0 and b then buyshort(1,1,nextopen); 其他条件没有改变
[此贴子已经被作者于2012-11-8 8:37:36编辑过]
|
-- 作者:jinzhe -- 发布时间:2012/11/8 9:35:16 -- 用旧图表测评,需要在测评第二步做价格的设置 |
-- 作者:every -- 发布时间:2012/11/8 9:35:17 -- 如果是次周期开盘价入场,BUY测评改为如下试试
a:=z>0;
b:=z<0;
if holding<0 and a then begin
sellshort(1,0,limit,open);
buy(1,1,limit,open);
end
if holding>0 and b then begin
sell(1,0,limit,open);
buyshort(1,1,limit,open);
end
if holding=0 and a then buy(1,1,limit,open);
if holding=0 and b then buyshort(1,1,limit,open);
|
-- 作者:烟圈 -- 发布时间:2012/11/8 11:37:25 -- 第二步已经做了价格设置 [此贴子已经被作者于2012-11-8 11:38:20编辑过]
|
-- 作者:烟圈 -- 发布时间:2012/11/8 11:37:54 -- 谢谢every兄 我先试试 |
-- 作者:烟圈 -- 发布时间:2012/11/8 12:09:37 -- 用every兄的改后,还是老样子。不过利润率降到8%了。。。。。。。。。贴不上图,不知道回帖怎么贴图 [此贴子已经被作者于2012-11-8 12:10:39编辑过]
|
-- 作者:jinzhe -- 发布时间:2012/11/8 13:23:03 -- a:=z>0;
b:=z<0;
if a then begin
sellshort(holding<0,0,nextopen);
buy(holding=0,1,nextopen);
end
if b then begin
sell(holding>0,0,nextopen);
buyshort(holding=0,1,nextopen);
end
改成这样呢
|
-- 作者:烟圈 -- 发布时间:2012/11/8 21:44:33 -- 可以了。 ![]() |
-- 作者:jinzhe -- 发布时间:2012/11/9 9:06:11 -- 正常的反手这么写,按照一楼的方法可能会造成不反手 |