以文本方式查看主题

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

--  作者:木鱼石传说
--  发布时间:2013/8/6 15:54:58
--  [原创]请教:尾盘平仓问题
想在15:14:00下单平仓,但尾盘平仓的时间老是与想要的不符,写过两种代码,都不符,请老师指点,现策略代码如下:

第一种:

平仓时间:=TIME>=CLOSETIME(0)-1*100;

收平多:sell(平仓时间 and holding>0, 0, thisclose);
收平空:sellshort(平仓时间 and holding<0,0,thisclose);

第二种:

  收平多:sell(time>151359 and holding>0, 0, thisclose);
  收平空:sellshort(time>151359 and holding<0,0,thisclose);

实盘时,用“固定时间间隔1秒”的轮询模式,一到尾盘,两种写法都在15:13:00就下单平仓了,我是想在15:14:00下单平仓的,应该怎么写代码,图表交易时用什么模式?

--  作者:jinzhe
--  发布时间:2013/8/6 15:56:43
--  
直接 time>151400
--  作者:木鱼石传说
--  发布时间:2013/8/6 16:00:54
--  
用固定时间间隔轮询模式,对吧?

如果要求在15:13:50之后平仓,应该怎么编写代码?

--  作者:jinzhe
--  发布时间:2013/8/6 16:07:56
--  

这个需要用currettime来判断

不过图表上得要这么写

if (islastbar and currettime>151350 ) or (not(islastbar) and time=151400)


--  作者:木鱼石传说
--  发布时间:2013/8/6 16:55:35
--  [原创]金泰铬:1月16日消息面分析现货白银走势完成拉升走高概率大
谢谢
--  作者:木鱼石传说
--  发布时间:2013/8/6 17:22:50
--  
编写不进去,是不是这样?

平仓时间:=  (islastbar and currettime>151350 ) or (not(islastbar) and time=151400);

  收平多:sell(平仓时间 and holding>0, 0, thisclose);
  收平空:sellshort(平仓时间 and holding<0,0,thisclose);

--  作者:jinzhe
--  发布时间:2013/8/7 8:44:19
--  
我写if是if ....then begin 的if,不是if(cond,a,b)的if