欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。


金字塔客服中心 - 专业程序化交易软件提供商金字塔软件公式模型编写问题提交 → [原创]完整策略模板

   

欢迎使用金字塔普通技术服务论坛,您可以在相关区域发表技术支持贴。
我司技术服务人员将优先处理 VIP客服论坛 服务贴,普通区问题处理速度慢,请耐心等待。谢谢您对我们的支持与理解。    


  共有15840人关注过本帖树形打印复制链接

主题:[原创]完整策略模板

帅哥哟,离线,有人找我吗?
z7c9
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[原创]完整策略模板  发帖心情 Post By:2010/8/24 10:50:56    Post IP:123.113.146.186[显示全部帖子]

以下内容为程序代码:

1 variable:maxprofit=0;
2 win:=0;
3 win2:=0;
4
5 if holding=0 then begin
6     //多头开仓
7     if tradingtime and enlongcond then begin
8         buy(1,1,limitr,close);
9         maxprofit:=0;
10     end
11     
12     //空头开仓
13     if tradingtime and enshortcond then begin
14         buyshort(1,1,limitr,close);
15         maxprofit:=0;
16     end
17 end
18
19 if holding>0 then begin
20     //多头平仓
21     if exlongcond then
22         sell(1,holding,limitr,close);
23
24     //多头收盘平仓
25     if not(tradingtime) then
26         sell(1,holding,limitr,close);
27
28     //盈亏计算
29     if enterbars>0 then begin
30         win:=(c-enterprice)/enterprice*100;
31         if win>maxprofit then
32             maxprofit:=win;
33         win2:=(maxproift-win)/maxprofit*100;
34     end
35
36     //多头初始止损
37     if win<-2 then
38         sell(1,holding,limitr,close);
39
40     //多头利润止盈
41     if win>4 then
42         sell(1,holding,limitr,close);
43     
44     //多头回撤止盈
45     if win2>60 and openprofit>0 then
46         sell(1,holding,limitr,close);
47 end
48
49 if holding<0 then begin
50     //空头平仓
51     if exshortcond then
52         sellshort(1,holding,limitr,close);
53
54     //空头收盘平仓
55     if not(tradingtime) then
56         sellshort(1,holding,limitr,close);
57     
58     //盈亏计算
59     if enterbars>0 then begin
60         win:=(enterprice-c)/enterprice*100;
61         if win>maxprofit then
62             maxprofit:=win;
63         win2:=(maxprofit-win)/maxprofit*100;
64     end
65
66     //空头初始止盈
67     if win<-2 then
68         sellshort(1,holding,limitr,close);
69
70     //空头利润止盈
71     if win>4 then
72         sellshort(1,holding,limitr,close);
73     
74     //空头回撤止盈
75     if win2>60 and openprofit>0 then
76         sellshort(1,holding,limitr,close);
77 end
78
79

[此贴子已经被作者于2010-8-24 11:01:40编辑过]

[本帖被加为精华]
 回到顶部