以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  [原创]请教限制盘前平仓的时间代码  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=55514)

--  作者:木鱼石传说
--  发布时间:2013/8/21 16:19:34
--  [原创]请教限制盘前平仓的时间代码
看了一些收盘前平仓的代码,搞乱了,请老师厘清!

股指期货,我现在要求在151359时无论什么头寸都下单平仓,这个代码应该怎么写?要用交易所时间,不是本地电脑的时间。

--  作者:jinzhe
--  发布时间:2013/8/21 16:23:04
--  
把刚才给你的时间判断改成151359
--  作者:木鱼石传说
--  发布时间:2013/8/21 19:40:26
--  
下面三种的哪一种?

DYNAINFO(207)>151339 and islastbar


time > 151359 and not(islastbar)


not(islastbar) and time=151500 or islastbar and currenttime>151359

--  作者:jinzhe
--  发布时间:2013/8/22 8:48:32
--  
我给你写的那种
--  作者:武田晴信
--  发布时间:2013/8/22 9:12:11
--  
not(islastbar) and time=151500 or islastbar and currenttime>151359
这个,你还是没有理解代码的含义
--  作者:fly
--  发布时间:2013/8/22 17:18:20
--  
楼上正解
not(islastbar) and time=151500 //非最后一根K线,时间151500平仓
 
 (islastbar and DYNAINFO(207)>151359)//最后一根K线,151359平仓----取的就是交易所时间
 
结合起来就是
not(islastbar) and time=151500 or  (islastbar and DYNAINFO(207)>151359)

--  作者:木鱼石传说
--  发布时间:2013/8/22 20:56:29
--  
not(islastbar) and time=151500 or  (islastbar and DYNAINFO(207)>151359);其中含有DYNAINFO(207)那还能用于历史评测吗?
--  作者:木鱼石传说
--  发布时间:2013/8/23 7:59:10
--  
    自己检测了一下,上述代码可以评测,不过在1minK线上对照一下信号,发现收盘平仓的信号出现在最后一根K线上,而个人原来的本意是要在倒数第二根K线走完时平仓,这样,于上述代码not(islastbar) and time=151500就有点出入,可否改成下面这样?
not(islastbar) and time=151400 or  (islastbar and DYNAINFO(207)>151359);

发现改成这样后,收盘信号就出现在倒数第二根K线上了,请老师指点!

--  作者:木鱼石传说
--  发布时间:2013/8/23 8:04:24
--  
not(islastbar) and time=151500 改成not(islastbar) and time=151400 ,是不是固定轮询模式时,在15:13:01就会被执行平仓了?
--  作者:木鱼石传说
--  发布时间:2013/8/23 15:24:34
--