以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 请教老师,当月最后一个交易日平仓 (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=74192) |
-- 作者:uheart -- 发布时间:2015/1/8 16:00:30 -- 请教老师,当月最后一个交易日平仓 请教老师,比如1月最后一个交易日,收盘时间全部平仓,应该怎么写啊? |
-- 作者:jinzhe -- 发布时间:2015/1/8 16:11:40 -- 这个是未来,不能写 如果要收盘时间平仓那么就是 if time=closetime(0) then begin sell(1,0,marketr); sellshort(1,0,marketr); end |
-- 作者:uheart -- 发布时间:2015/1/8 16:29:34 -- 过去的可以写吗?比如if1012,在交割日收盘平仓,应该如何写好呢? |
-- 作者:jinzhe -- 发布时间:2015/1/8 16:42:56 -- 思路是一样的都要判断未来 |
-- 作者:uheart -- 发布时间:2015/1/8 16:45:09 -- 以下是引用jinzhe在2015/1/8 16:11:40的发言:
这个是未来,不能写 如果要收盘时间平仓那么就是 if time=closetime(0) then begin sell(1,0,marketr); sellshort(1,0,marketr); end
我把想法写出来,麻烦请老师指点。 (以下为if06合约和12合约交接日收盘平仓)
d06:= year=2010 and month=6 and day=18 or year=2011 and month=6 and day=17 d12:= year=2010 and month=12 and day=17 or year=2011 and month=12 and day=16
if d06 and time=closetime(0) then begin
就是把过去发生过的交割日自己写进去,收盘平仓,便于测试。老师您看看对不对?
|
-- 作者:jinzhe -- 发布时间:2015/1/8 16:45:46 -- 用枚举法没有普遍性,只能是用来测评了 |
-- 作者:uheart -- 发布时间:2015/1/8 16:47:17 -- 以下是引用jinzhe在2015/1/8 16:45:46的发言:
用枚举法没有普遍性,只能是用来测评了
老师,不知道学生以上的写法对不对,请指点啊! |
-- 作者:uheart -- 发布时间:2015/1/8 16:52:11 -- 以下是引用jinzhe在2015/1/8 16:45:46的发言:
用枚举法没有普遍性,只能是用来测评了
拉回去看,这个写法没有在20140620平仓,写法有问题,请老师不吝赐教啊 |
-- 作者:jinzhe -- 发布时间:2015/1/8 16:56:19 -- if (d06 or d12) and time=closetime(0) then begin |
-- 作者:uheart -- 发布时间:2015/1/8 17:03:40 -- 以下是引用jinzhe在2015/1/8 16:56:19的发言:
if (d06 or d12) and time=closetime(0) then begin 不行啊老师,如图,06合约14年6月20号还是没有平仓,不知道为什么,请老师帮助看看问题所在好吗? 代码如下
d06:= year=2010 and month=6 and day=18 or year=2011 and month=6 and day=17 d12:= year=2010 and month=12 and day=17 or year=2011 and month=12 and day=16
if (d06 or d12) and time=closetime(0) then begin
|