Rss & SiteMap

金字塔客服中心 - 专业程序化交易软件提供商 http://www.weistock.com/bbs/

专业程序化软件提供商
共44 条记录, 每页显示 10 条, 页签: [1] [2][3][4][5]
[浏览完整版]

标题:请教老师,当月最后一个交易日平仓

1楼
uheart 发表于:2015/1/8 16:00:30
请教老师,比如1月最后一个交易日,收盘时间全部平仓,应该怎么写啊?
2楼
jinzhe 发表于:2015/1/8 16:11:40

这个是未来,不能写

如果要收盘时间平仓那么就是

if time=closetime(0) then begin

   sell(1,0,marketr);

   sellshort(1,0,marketr);

end

3楼
uheart 发表于:2015/1/8 16:29:34
过去的可以写吗?比如if1012,在交割日收盘平仓,应该如何写好呢?
4楼
jinzhe 发表于:2015/1/8 16:42:56

思路是一样的都要判断未来

5楼
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
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

 

就是把过去发生过的交割日自己写进去,收盘平仓,便于测试。老师您看看对不对?

 

 

6楼
jinzhe 发表于:2015/1/8 16:45:46
用枚举法没有普遍性,只能是用来测评了
7楼
uheart 发表于:2015/1/8 16:47:17
以下是引用jinzhe在2015/1/8 16:45:46的发言:
用枚举法没有普遍性,只能是用来测评了

 

老师,不知道学生以上的写法对不对,请指点啊!

8楼
uheart 发表于:2015/1/8 16:52:11
以下是引用jinzhe在2015/1/8 16:45:46的发言:
用枚举法没有普遍性,只能是用来测评了

 

拉回去看,这个写法没有在20140620平仓,写法有问题,请老师不吝赐教啊

9楼
jinzhe 发表于:2015/1/8 16:56:19

if (d06 or d12) and time=closetime(0) then begin
  sell(1,0,marketr);
  sellshort(1,0,marketr);
 end
end

10楼
uheart 发表于:2015/1/8 17:03:40
以下是引用jinzhe在2015/1/8 16:56:19的发言:

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

 

 


图片点击可在新窗口打开查看此主题相关图片如下:06合约20140620.png
图片点击可在新窗口打开查看

 

共44 条记录, 每页显示 10 条, 页签: [1] [2][3][4][5]


Powered By Dvbbs Version 8.3.0
Processed in 0.03125 s, 3 queries.