Rss & SiteMap

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

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

标题:菜鸟求助,麻烦各位老师帮忙编写一个自动交易程序

1楼
crocodile 发表于:2014/4/10 14:58:33

思路:

1:空仓情况下(2个常量:X/Y)

   收盘价上穿X开多,如果收盘前下破X平多,否则持多仓过夜;
   收盘价下破Y开空,如果收盘前上穿Y平空,否则持空仓过夜;


2:持仓情况下(2个常量:X/Y)

   持多仓:
   收盘价下破Y平多开空,如果收盘前上穿Y平空开多,否则持空仓过夜;

   持空仓:
   收盘价上穿X平空开多,如果收盘前下穿X平多开空,否则持多仓过夜;

 

 

 

谢谢您!

2楼
jinzhe 发表于:2014/4/10 15:18:08

if holding=0 and cross(close,x) then begin

   buy(1,1,market);

end

 

if cross(x,close) and holding>0 then begin

   sell(1,0,market);

 end

 

if holding=0 and cross(y,close) then begin

    buyshort(1,1,market);

end

 

if holding<0 and cross(close,y) then begin

    sellshort(1,0,market);

end

 

 

if holding>0 and cross(y,close) then begin

    sell(1,0,market);

    buyshort(holding=0,1,market);

end

 

if  cross(close,y) then begin

   sellshort(1,0,market);

   buy(holding=0,1,market);

end

 

if holding<0 and cross(close,x) then begin

  sellshort(1,0,market);

  buy(holding=0,1,market);

end

 

if cross(x,close) then begin

   sell(1,0,market);

   buyshort(holding=0,1,market);

end

 

 

3楼
crocodile 发表于:2014/4/10 15:48:32
非常感谢!这是图标交易吧?IF.....then的结构是什么语言啊?我学金字塔学的BUY/SELL,BUYSHORT/SELLSHORT用在什么地方啊?如果我想要系统学习的话,老师给推荐一个步骤或书目、资料。。。非常感谢您!
4楼
jinzhe 发表于:2014/4/10 16:03:14

初级篇的教程先看起来吧

http://www.weistock.com/bbs/dispbbs.asp?boardid=16&Id=55132

 

5楼
Crocodile 发表于:2014/4/10 18:01:21
buy(1,1,market) 老师不好意思,上面两个1是啥意思?
6楼
Crocodile 发表于:2014/4/10 18:35:54
不好意思,上面的思路是交易时间都交易,从090000到145900都有效,我看您写的策略里没有时间限定,是不是默认全时段交易了呢?谢谢您的关注
7楼
qq代人发帖 发表于:2014/4/10 21:42:32
第一个1是条件恒成立,第二个1是买1手。 没有时间限制就是有行情时都交易。
8楼
crocodile 发表于:2014/4/11 0:10:54
多谢!
9楼
crocodile 发表于:2014/4/11 1:07:05
老师您好,我如何让系统知道我的仓位现在是Holding>0或Holding<0还是Holding=0的情况呢?谢谢
10楼
crocodile 发表于:2014/4/11 7:53:09

老师您好,下面这一段在主图显示的时候好像有问题:

 

if holding>0 and cross(y,close) then begin

    sell(1,0,market);

    buyshort(holding=0,1,market);

end

 

我没法贴图,只能尽量说明白:此段的原意是如果持多仓 and 收盘价下破y,则平多开空, 但是主图没有平多开空这个动作,只有一个开多,不知咋回事。另外麻烦问一下“ sell(1,0,market);”这里的0是啥意思?我如果想要控制上述动作的先后顺序,应该怎么做?

 

谢谢老师图片点击可在新窗口打开查看

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


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