Rss & SiteMap

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

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

标题:加仓后平一半仓位怎么写?

1楼
弦外之音 发表于:2011/8/7 23:11:02

请教老师,以下平一半仓位怎么写?

if ref(c,1)>=ref(o,1) and c<o and holding>o then begin

    (此处平一半仓位);

 

if ref(c,1)<ref(o,1) and c<o and holding>0 then begin

    sell(1,0,limitr,c);//------------此处平掉余下的仓位。

 

if c>o and holding=o then begin

    buy(1,1,limitr,c);

 

if c>o and holding=1 then begin

    buy(1,1,limitr,c);

 

if c>o and holding=2 then begin

    buy(1,1,limitr,c);

 

if c>o and holding=3 then begin

    buy(1,1,limitr,c);

 

if c>o and holding=4 then begin

    buy(1,1,limitr,c);

 

if c>o and holding=5 then begin

    buy(1,1,limitr,c);

 

if c>o and holding=6 then begin

    buy(1,1,limitr,c);

......

[此贴子已经被作者于2011-8-7 23:12:25编辑过]
2楼
guotx2010 发表于:2011/8/8 8:22:51
sell(1,50%,limitr,c); //50%就是一半仓位了
3楼
弦外之音 发表于:2011/8/8 8:59:25
谢谢斑竹,意思是M%就是平百分几的仓位了??那如果总持仓是11手,总持仓是一半是0.55手,实际是平5手还是6手呢??
4楼
阿火 发表于:2011/8/8 9:10:54

好懒,自己随便写个程序加载一下看看就清楚了

5楼
xian_0_9 发表于:2011/8/9 10:06:07
6手?
6楼
fly 发表于:2011/8/9 11:06:45

11*0.55取整是6,6手.

按4楼的方法,在图上一看,很明显的

共6 条记录, 每页显示 10 条, 页签: [1]


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