以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://weistock.com/bbs/index.asp)
--  交易策略发布专区  (http://weistock.com/bbs/list.asp?boardid=10)
----  [交易系统]三均线指路  (http://weistock.com/bbs/dispbbs.asp?boardid=10&id=5097)

--  作者:z7c9
--  发布时间:2011/2/6 13:00:51
--  [交易系统]三均线指路

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

 

以下内容为程序代码:

1 runmode:0;
2
3 input:period1(4,1,100,1);
4 input:period2(9,1,100,1);
5 input:period3(18,1,100,1);
6
7 variable:myasset=30000;
8
9 entertime:=time>=092500 and time<=145500;
10 exittime:=time>=150000;
11
12 ma1:=ma(close,period1);
13 ma2:=ma(close,period2);
14 ma3:=ma(close,period3);
15
16 buycond:=entertime and ref(close>ma1 and ma1>ma2 and ma2>ma3,1);
17 buyprice:=open;
18
19 buyshortcond:=entertime and ref(close<ma1 and ma1<ma2 and ma2<ma3,1);
20 buyshortprice:=open;
21
22 if holding=0 and buycond then begin
23     buy(1,1,limitr,buyprice);
24 end
25
26 if holding=0 and buyshortcond then begin
27     buyshort(1,1,limitr,buyshortprice);
28 end
29
30 if holding>0 and exittime then begin
31     sell(1,holding,limitr,close);
32 end
33
34 if holding<0 and exittime then begin
35     sellshort(1,holding,limitr,close);
36 end
37
38 if exittime then
39     myasset:=asset;
40     
41 资产:myasset,noaxis,colormagenta;
42 次数:totaltrade,linethick0;
43 收益:(myasset-30000)/30000,linethick0;
44 胜率:percentwin,linethick0;
45 出击:totaltrade/(count(date<>ref(date,1),0)+1),linethick0;
46 连亏:maxseqloss,linethick0;
47 连赢:maxseqwin,linethick0;
48

[此贴子已经被作者于2011-10-3 11:28:58编辑过]

--  作者:王锋
--  发布时间:2011/2/6 14:18:38
--  
楼主这么牛,一下子发那么多交易系统哇
--  作者:wshj1214
--  发布时间:2011/2/8 22:40:47
--  

代码导入后,调试不成立,PERIOD未定义,2等无内容处需要定义


--  作者:admin
--  发布时间:2011/2/8 22:46:06
--  
建议楼主发代码时,不要按代码方式插入,这样前面会加行号,给其他用户导入带来困难
--  作者:admin
--  发布时间:2011/2/8 22:55:57
--  
代码是可以工作的,只要将前面的行号去掉,然后再将代码里的大于小于号的全角字符改成半角就行了