以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 加入交易次数限制后结果异常 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=67917) |
-- 作者:cssfortune -- 发布时间:2014/7/28 12:22:59 -- 加入交易次数限制后结果异常 早盘突破系统,1分钟上测试2年, 刚开始写完交易次数是1700多;后来添加了一个每天只能交易一手的条件,结果交易次数只有3次了! 添加了交易次数限制的代码如下,是我写的逻辑出错了吗?
input:T(30,5,60,5),
n:=barslast(date<>ref(date,1))+1;//开盘以来的K线数量
stopbuy:max(valuewhen(n=1,open),ref(high,1)*(1-0.5/100)),linedot;//多头止损价位 stopshort:min(valuewhen(n=1,open),ref(low,1)*(1-0.5/100)),linedot;//空头止损价位
if entertime and holding=0 and num<CS then {开仓入场}
if enterbars>1 and holding<>0 then {止损离场}
if exittime and holding<>0 then {收盘平仓}
持仓:holding,linethick0;
|
-- 作者:cssfortune -- 发布时间:2014/7/28 12:24:43 -- 并且检查了一下图表,本来当天是数据是满足交易条件的,却没有显示也没有执行交易信号。 |
-- 作者:jinzhe -- 发布时间:2014/7/28 13:22:14 -- if exittime and holding<>0 then {收盘平仓}
改成
if exittime and holding<>0 then {收盘平仓} if exittime then NUM:=0; |
-- 作者:cssfortune -- 发布时间:2014/7/28 13:35:51 -- 试了一下,的确纠正过来了 |