以文本方式查看主题 - 金字塔客服中心 - 专业程序化交易软件提供商 (http://weistock.com/bbs/index.asp) -- 公式模型编写问题提交 (http://weistock.com/bbs/list.asp?boardid=4) ---- 加仓后平一半仓位怎么写? (http://weistock.com/bbs/dispbbs.asp?boardid=4&id=7447) |
-- 作者:弦外之音 -- 发布时间: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编辑过]
|
-- 作者:guotx2010 -- 发布时间:2011/8/8 8:22:51 -- sell(1,50%,limitr,c); //50%就是一半仓位了 |
-- 作者:弦外之音 -- 发布时间:2011/8/8 8:59:25 -- 谢谢斑竹,意思是M%就是平百分几的仓位了??那如果总持仓是11手,总持仓是一半是0.55手,实际是平5手还是6手呢?? |
-- 作者:阿火 -- 发布时间:2011/8/8 9:10:54 -- 好懒,自己随便写个程序加载一下看看就清楚了 |
-- 作者:xian_0_9 -- 发布时间:2011/8/9 10:06:07 -- 6手? |
-- 作者:fly -- 发布时间:2011/8/9 11:06:45 -- 11*0.55取整是6,6手. 按4楼的方法,在图上一看,很明显的 |