以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  公式模型编写问题提交  (http://weistock.com/bbs/list.asp?boardid=4)
----  请教:要在151338时才平仓,要怎么编写呢?  (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=52063)

--  作者:木鱼石传说
--  发布时间:2013/5/15 15:44:33
--  请教:要在151338时才平仓,要怎么编写呢?
本人在策略中编写了以下代码:

//收盘前自动平仓
if time > 151338 then begin
    sell(holding > 0, 0, thisclose);
    sellshort(holding < 0, 0, thisclose);
    end
请教:
    1,上述代码采用“固定时间间隔”轮询模式,时间间隔采用1秒钟,为什么执行的结果是15:13:00就下单平仓了,是什么原因?
    2,time取得的时间的本地计算机时间还是交易所行情时间?
    3,要完成15:13:38后才执行自动平仓,代码应该怎么写?
谢谢!

--  作者:fly
--  发布时间:2013/5/15 16:53:21
--  
代码运行在几分钟周期?
--  作者:木鱼石传说
--  发布时间:2013/5/15 16:59:13
--  
1分钟周期
--  作者:木鱼石传说
--  发布时间:2013/5/15 17:00:44
--  
以下是引用fly在2013-5-15 16:53:21的发言:
代码运行在几分钟周期?应用在1分钟的K线周期上


--  作者:fly
--  发布时间:2013/5/15 17:08:01
--  
//“固定时间间隔”轮询模式,1分钟周期
 
if DYNAINFO(207)>151338 and islastbar then begin
    sell(holding > 0, 0, thisclose);
    sellshort(holding < 0, 0, thisclose);
    end
 
if time > 151400 and not(islastbar) then begin
    sell(holding > 0, 0, thisclose);
    sellshort(holding < 0, 0, thisclose);
    end

--  作者:木鱼石传说
--  发布时间:2013/5/15 21:13:42
--  
以下是引用fly在2013-5-15 17:08:01的发言:
//“固定时间间隔”轮询模式,1分钟周期
 
if DYNAINFO(207)>151338 and islastbar then begin
    sell(holding > 0, 0, thisclose);
    sellshort(holding < 0, 0, thisclose);
    end
 
if time > 151400 and not(islastbar) then begin
    sell(holding > 0, 0, thisclose);
    sellshort(holding < 0, 0, thisclose);
    end


请教:

这是两种不同的代码表达方式还是结合起来才能达到尾盘平仓的要求?


--  作者:木鱼石传说
--  发布时间:2013/5/15 21:14:28
--  
另,能否进行策略评测?
--  作者:木鱼石传说
--  发布时间:2013/8/21 16:04:18
--  
回顾一下
--  作者:木鱼石传说
--  发布时间:2013/8/21 16:08:42
--  
请教老师:

您提供的这两种不同的代码表达方式还是结合起来才能达到尾盘平仓的要求?