Rss & SiteMap

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

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

标题:[交易系统]双均线穿越

1楼
z7c9 发表于:2011/2/6 12:53:38

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

 

以下内容为程序代码:

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

[此贴子已经被作者于2011-10-3 11:29:05编辑过]
2楼
董小球 发表于:2011/2/9 10:14:49
斑竹大大 给力啊~~~图片点击可在新窗口打开查看
共2 条记录, 每页显示 10 条, 页签: [1]


Powered By Dvbbs Version 8.3.0
Processed in 3.09766 s, 2 queries.