这个是未来,不能写
如果要收盘时间平仓那么就是
if time=closetime(0) then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
end
思路是一样的都要判断未来
这个是未来,不能写
如果要收盘时间平仓那么就是
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
or year=2012 and month=6 and day=15 or year=2013 and month=6 and day=21
or year=2014 and month=6 and day=20;
d12:= year=2010 and month=12 and day=17 or year=2011 and month=12 and day=16
or year=2012 and month=12 and day=21 or year=2013 and month=12 and day=20
or year=2014 and month=12 and day=19;
if d06 and time=closetime(0) then begin
if d12 and time=closetime(0) then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
end
end
就是把过去发生过的交割日自己写进去,收盘平仓,便于测试。老师您看看对不对?
老师,不知道学生以上的写法对不对,请指点啊!
拉回去看,这个写法没有在20140620平仓,写法有问题,请老师不吝赐教啊
if (d06 or d12) and time=closetime(0) then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
end
end
if (d06 or d12) and time=closetime(0) then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
end
end
不行啊老师,如图,06合约14年6月20号还是没有平仓,不知道为什么,请老师帮助看看问题所在好吗?
代码如下
d06:= year=2010 and month=6 and day=18 or year=2011 and month=6 and day=17
or year=2012 and month=6 and day=15 or year=2013 and month=6 and day=21
or year=2014 and month=6 and day=20;
d12:= year=2010 and month=12 and day=17 or year=2011 and month=12 and day=16
or year=2012 and month=12 and day=21 or year=2013 and month=12 and day=20
or year=2014 and month=12 and day=19;
if (d06 or d12) and time=closetime(0) then begin
sell(1,0,marketr);
sellshort(1,0,marketr);
end