发现这可能是一个bug 那位斑竹过来看看 利用 leevolvo版主的语句
if (buycond and not(islastbar)) or (buycond and islastbar and dynainfo(207)>ref(time,1)+58) then buy(1,1,limitr,c); 代替if buycond then buy(1,1,limitr,c);
带入策略运行
60分钟线 假设现在是早上9点50测试 或实盘运行 那么利用if buycond then buy(1,1,limitr,c); 这样的语句的 策略发出的 在以前收盘价时的信号
在用有if (buycond and not(islastbar)) or (buycond and islastbar and dynainfo(207)>ref(time,1)+58) then buy(1,1,limitr,c);的策略中测试时 应该是没有的 。因为 这时的
对于dynainfo(207)<ref(time,1)+58 (095000<150058) 但是我测试时发现这个信号并没丢失。图表上依然能够看到。难道金字塔运行测试时不是一根k线接着一根k线运行的吗?
buycond and not(islastbar) 这个是显示历史信号
buycond and islastbar and dynainfo(207)>ref(time,1)+58 这个是实时信号
不会消失
另:此实例只是一个示例,示例本身不够完整。对于提前下单,实盘中有许多细节需要处理。慎用
请教一下 我以前的理解是这样的 :buycond and not(islastbar) 是指不是在最后收盘价成交的信号
而buycond and islastbar and dynainfo(207)>ref(time,1)+58 是指在 最后收盘价成交的信号
看了你的解释后 我把buycond and not(islastbar) 改为 buycond and islastbar 结果什么信号也没了。
然后我把buycond and islastbar and dynainfo(207)>ref(time,1)+58 这个条件删除 结果真如你所说
所有信号依然显示 。那意思就是说设置为固定时间间隔
所有信号还是按照开盘条件成立就成交 并不能达到在收盘前提前下单的结果。不知我的理解对否?
还有一个问题 如何理解not(islastbar)?
我知道会有风险,但希望能找到比较完善的解决之道。最近好长一段时间搜索翻看咱论坛里的帖子,发现有此要求的挺多,以前也有对此提出之道的。比如
http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=162&page=2
还有http://www.weistock.com/bbs/dispbbs.asp?boardid=4&id=2380 然后
http://www.weistock.com/bbs/dispbbs.asp?boardid=2&id=6654 但好像都有问题 。
当时我觉得最好的办法是leevolvo斑竹提到的 “
比如 条件成立,临近收盘下单,1分钟K线图
就可以这样写:
if (buycond and not(islastbar)) or (buycond and islastbar and dynainfo(207)>ref(time,1)+58) then buy(1,1,limitr,c);
当然,也可以用currenttime ,只是,currenttime经常不准,可能是服务器问题,也可能是电脑主板问题。每天都会走慢
还有一种情况,是在行情卡的时候,currenttime不停的走,而tick数据还没过来,这个时候currenttime也不能准确描述“临近收盘”这一层意思
而且tick上的时间才能准确描述 “临近收盘”这个意思”
但使起来发现并不是如想象的那样 故此有此一帖 。欢迎大家讨论。
我实际把 buycond and islastbar and dynainfo(207)>ref(time,1)+58改为buycond and islastbar and dynainfo(207)>time-2 ;这样不会有跨天的问题。
leevolvo 版主 能否给个比较完善的实例啊 我这是黔驴技穷了 ,
今天再次测试 用 buycond and islastbar and dynainfo(207)>time-10 ;带入策略 ,发现图上有信号,但并不真的下单。
--------------发现dynainfo(207)虽然是时间常数 但是并不是60进制,知道错误的原因了