Rss & SiteMap

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

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

标题:加仓模型

1楼
zzsg 发表于:2013/3/14 10:24:47
金字塔老师您好,我是你们的客户,我编了几天就是搞不成这个想法,麻烦给编一个:
X:=5;
A:=4
开多仓条件:CLOSE>M(c,30)+X;
   符合这个开仓条件的后边1、2、3、4根线的次周期开盘价加仓,加仓4根线不再加仓
平多仓条件:CLOSE<最后开多价格-A;
开空仓条件:CLOSE<M(c,30)-X;
   符合这个开仓条件的后边1、2、3、4根线的次周期开盘价加仓,加仓4根线不再加仓
平空仓条件:CLOSE<最后开空价格+A;
2楼
jinzhe 发表于:2013/3/14 10:41:46
这种不好写的,类似于确定现在条件再往后推,都有种未来的意思
3楼
qwe123 发表于:2013/3/14 10:58:45
x:=5;
a:=4;
r1:=c>ma(c,30)+x;
if r1 then buy(holding=0,1,thisclose);
if ref(r1,1) and enterbars=2 then buy(holding=1,1,limitr,o);
if ref(r1,1) and enterbars=1 then buy(holding=2,1,limitr,o);
if ref(r1,1) and enterbars=1 then buy(holding=3,1,limitr,o);
if enterprice-c>a then sell(holding>0,0,limitr,enterprice-a);

自己调试测试一下,随手写的供参考。



4楼
qwe123 发表于:2013/3/14 11:05:31
x:=5;
a:=4;
cx:=4;//最大持仓
r1:=c>ma(c,30)+x;
if r1 then buy(holding=0,1,thisclose);
if ref(r1,1) and enterbars=2 then buy(holding=1,1,limitr,o);
if ref(r1,1) and enterbars=1 then buy(holding<cx,1,limitr,o);
if enterprice-c>a then sell(holding>0,0,limitr,enterprice-a);

同样的方法写加空仓位。
5楼
zzsg 发表于:2013/3/14 12:50:40
这个还是不行呀,图片放不上去,你倒进去看看

6楼
zzsg 发表于:2013/3/14 12:51:11
如何发图片呢,否则看不清楚
7楼
zzsg 发表于:2013/3/14 13:33:09
现在条件 再往后推,不可能有未来的意思,那不是所有技术都不能交易了吗
技术本来就是统计前边,这个策略也是呀
8楼
fly 发表于:2013/3/14 13:55:34

//只写了多仓

x:=5;
a:=4;
ma30:ma(c,30);
r1:=c>ma30+x;

if r1 then buy(holding=0,1,market);
if ref(r1,1) and holding=1 then buy(1,1,market);
if ref(r1,2) and holding=2 then buy(1,1,market);
if ref(r1,3) and holding=3 then buy(1,1,market);


if c<enterprice-a then sell(holding>0,0,market);

9楼
zzsg 发表于:2013/3/14 14:35:20
谢谢老师,我试试
共9 条记录, 每页显示 10 条, 页签: [1]


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