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


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

   

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


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

主题:[原创]PEL设计模式之模板模式

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


加好友 发短信
等级:小飞侠 帖子:1882 积分:3310 威望:0 精华:15 注册:2010/3/15 13:11:56
[原创]PEL设计模式之模板模式  发帖心情 Post By:2011/1/1 15:27:46    Post IP:114.243.126.219[只看该作者]

AbstractStrategy:

 

以下内容为程序代码:

1 runmode:0;
2
3 input:system(1,1,2,1);
4
5 if holding=0 then begin
6     buycond:=stkindi(stklabel,'ContractStrategy.buycond('+numtostr(system,0)+')',0,dataperiod),linethick0;
7     buyprice:=stkindi(stklabel,'ContractStrategy.buyprice('+numtostr(system,0)+')',0,dataperiod),linethick0;
8     buylots:=stkindi(stklabel,'ContractStrategy.buylots('+numtostr(system,0)+')',0,dataperiod),linethick0;
9         
10     if buycond then
11         buy(1,buylots,limitr,buyprice);
12 end
13
14 if holding=0 then begin
15     buyshortcond:=stkindi(stklabel,'ContractStrategy.buyshortcond('+numtostr(system,0)+')',0,dataperiod);
16     buyshortprice:=stkindi(stklabel,'ContractStrategy.buyshortprice('+numtostr(system,0)+')',0,dataperiod);
17     buyshortlots:=stkindi(stklabel,'ContractStrategy.buyshortlots('+numtostr(system,0)+')',0,dataperiod);
18     
19     if buyshortcond then
20         buyshort(1,buyshortlots,limitr,buyshortprice);
21 end
22
23 if holding>0 then begin
24     sellcond:=stkindi(stklabel,'ContractStrategy.sellcond('+numtostr(system,0)+')',0,dataperiod);
25     sellprice:=stkindi(stklabel,'ContractStrategy.sellprice('+numtostr(system,0)+')',0,dataperiod);
26     selllots:=stkindi(stklabel,'ContractStrategy.selllots('+numtostr(system,0)+')',0,dataperiod);
27     
28     if sellcond then
29         sell(1,selllots,limitr,sellprice);
30 end
31
32 if holding<0 then begin
33     sellshortcond:=stkindi(stklabel,'ContractStrategy.sellshortcond('+numtostr(system,0)+')',0,dataperiod);
34     sellshortprice:=stkindi(stklabel,'ContractStrategy.sellshortprice('+numtostr(system,0)+')',0,dataperiod);
35     sellshortlots:=stkindi(stklabel,'ContractStrategy.sellshortlots('+numtostr(system,0)+')',0,dataperiod);
36     
37     if sellshortcond then
38         sell(1,sellshortlots,limitr,sellshortprice);
39 end

 

ContractStrategy:

 

以下内容为程序代码:

1 runmode:0;
2
3 input:system(1,1,2,1);
4
5 buycond:if(system=1,1,if(system=2,0,0));
6 buyprice:if(system=1,close,if(system=2,open,0));
7 buylots:if(system=1,1,if(system=2,2,0));
8
9 buyshortcond:if(system=1,1,if(system=2,0,0));
10 buyshortprice:if(system=1,close,if(system=2,open,0));
11 buyshortlots:if(system=1,1,if(system=2,2,0));
12
13 sellcond:if(system=1,1,if(system=2,0,0));
14 sellprice:if(system=1,close,if(system=2,open,0));
15 selllots:if(system=1,1,if(system=2,2,0));
16
17 sellshortcond:if(system=1,1,if(system=2,0,0));
18 sellshortprice:if(system=1,close,if(system=2,open,0));
19 sellshortlots:if(system=1,1,if(system=2,2,0));
 

 

[此贴子已经被作者于2011-1-1 15:29:04编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
solarhe2006
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:252 积分:1001 威望:0 精华:0 注册:2010/2/15 16:47:58
[公告]上海中期北京营业部与金字塔合作  发帖心情 Post By:2011/8/17 0:43:40    Post IP:121.195.55.179[只看该作者]

[原创]PEL设计模式之模板模式  发帖心情 Post By:2011-1-1 15:27:46

AbstractStrategy:

 

以下内容为程序代码:

1 runmode:0;
2
3 input:system(1,1,2,1);
4
5 if holding=0 then begin
6     buycond:=stkindi(stklabel,'ContractStrategy.buycond('+numtostr(system,0)+')',0,dataperiod),linethick0;
7     buyprice:=stkindi(stklabel,'ContractStrategy.buyprice('+numtostr(system,0)+')',0,dataperiod),linethick0;
8     buylots:=stkindi(stklabel,'ContractStrategy.buylots('+numtostr(system,0)+')',0,dataperiod),linethick0;
9         
10     if buycond then
11         buy(1,buylots,limitr,buyprice);
12 end
13
14 if holding=0 then begin
15     buyshortcond:=stkindi(stklabel,'ContractStrategy.buyshortcond('+numtostr(system,0)+')',0,dataperiod);
16     buyshortprice:=stkindi(stklabel,'ContractStrategy.buyshortprice('+numtostr(system,0)+')',0,dataperiod);
17     buyshortlots:=stkindi(stklabel,'ContractStrategy.buyshortlots('+numtostr(system,0)+')',0,dataperiod);
18     
19     if buyshortcond then
20         buyshort(1,buyshortlots,limitr,buyshortprice);
21 end
22
23 if holding>0 then begin
24     sellcond:=stkindi(stklabel,'ContractStrategy.sellcond('+numtostr(system,0)+')',0,dataperiod);
25     sellprice:=stkindi(stklabel,'ContractStrategy.sellprice('+numtostr(system,0)+')',0,dataperiod);
26     selllots:=stkindi(stklabel,'ContractStrategy.selllots('+numtostr(system,0)+')',0,dataperiod);
27     
28     if sellcond then
29         sell(1,selllots,limitr,sellprice);
30 end
31
32 if holding<0 then begin
33     sellshortcond:=stkindi(stklabel,'ContractStrategy.sellshortcond('+numtostr(system,0)+')',0,dataperiod);
34     sellshortprice:=stkindi(stklabel,'ContractStrategy.sellshortprice('+numtostr(system,0)+')',0,dataperiod);
35     sellshortlots:=stkindi(stklabel,'ContractStrategy.sellshortlots('+numtostr(system,0)+')',0,dataperiod);
36     
37     if sellshortcond then
38         sell(1,sellshortlots,limitr,sellshortprice);
39 end

 

ContractStrategy:

 

以下内容为程序代码:

1 runmode:0;
2
3 input:system(1,1,2,1);
4
5 buycond:if(system=1,1,if(system=2,0,0));
6 buyprice:if(system=1,close,if(system=2,open,0));
7 buylots:if(system=1,1,if(system=2,2,0));
8
9 buyshortcond:if(system=1,1,if(system=2,0,0));
10 buyshortprice:if(system=1,close,if(system=2,open,0));
11 buyshortlots:if(system=1,1,if(system=2,2,0));
12
13 sellcond:if(system=1,1,if(system=2,0,0));
14 sellprice:if(system=1,close,if(system=2,open,0));
15 selllots:if(system=1,1,if(system=2,2,0));
16
17 sellshortcond:if(system=1,1,if(system=2,0,0));
18 sellshortprice:if(system=1,close,if(system=2,open,0));
19 sellshortlots:if(system=1,1,if(system=2,2,0));
 

 


 回到顶部
帅哥哟,离线,有人找我吗?
solarhe2006
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:论坛游侠 帖子:252 积分:1001 威望:0 精华:0 注册:2010/2/15 16:47:58
[公告]上海中期北京营业部与金字塔合作  发帖心情 Post By:2011/8/19 0:03:46    Post IP:121.195.55.179[只看该作者]

引用资金:stkindi('stklabel','HMSystem.myasset',0,2,0),colorgreen,noaxis;

 回到顶部