以文本方式查看主题

-  金字塔客服中心 - 专业程序化交易软件提供商  (http://222.73.7.161/bbs/index.asp)
--  公式模型编写问题提交  (http://222.73.7.161/bbs/list.asp?boardid=4)
----  [原创]历史结算价的计算方法  (http://222.73.7.161/bbs/dispbbs.asp?boardid=4&id=4321)

--  作者:z7c9
--  发布时间:2010/12/8 13:12:22
--  [原创]历史结算价的计算方法

以下内容为程序代码:

1 if strcmp(marketlabel,\'SQ\')=0 then begin
2     label:=strleft(stklabel,2);
3     
4     if strcmp(label,\'CU\')=0 then begin        
5         pricelimit:=0.06;    
6         marginlevel:=0.16;
7         commission:=0.03;                        
8         goto next2@;
9     end;
10     
11     if strcmp(label,\'AL\')=0 then begin                            
12         pricelimit:=0.06;    
13         marginlevel:=0.14;        
14         commission:=6;                    
15         goto next2@;
16     end;    
17     
18     if strcmp(label,\'ZN\')=0 then begin        
19         pricelimit:=0.06;    
20         marginlevel:=0.17;
21         commission:=12;    
22         goto next2@;
23     end;
24     
25     if strcmp(label,\'RU\')=0 then begin        
26         pricelimit:=0.06;    
27         marginlevel:=0.18;
28         commission:=0.015;     
29         goto next2@;
30     end;    
31     
32     if strcmp(label,\'AU\')=0 then begin        
33         pricelimit:=0.06;    
34         marginlevel:=0.14;
35         commission:=45;            
36         goto next2@;
37     end;
38     
39     if strcmp(label,\'FU\')=0 then begin        
40         pricelimit:=0.06;    
41         marginlevel:=0.16;
42         commission:=3;            
43         goto next2@;
44     end;    
45     
46     if strcmp(label,\'RB\')=0 then begin            
47         pricelimit:=0.06;    
48         marginlevel:=0.16;
49         commission:=0.015;    
50         goto next2@;
51     end;
52         
53     if strcmp(label,\'WR\')=0 then begin        
54         pricelimit:=0.06;    
55         marginlevel:=0.15;
56         commission:=0.015;            
57         goto next2@;
58     end;
59 end;
60
61 if strcmp(marketlabel,\'DQ\')=0 then begin
62     label:=strleft(stklabel,1);
63     
64     if strcmp(label,\'A\')=0 then begin        
65         pricelimit:=0.06;    
66         marginlevel:=0.15;
67         commission:=6;            
68         goto next2@;
69     end;    
70     
71     if strcmp(label,\'B\')=0 then begin
72         pricelimit:=0.06;    
73         marginlevel:=0.15;
74         commission:=6;        
75         goto next2@;
76     end;
77     
78     if strcmp(label,\'C\')=0 then begin        
79         pricelimit:=0.06;    
80         marginlevel:=0.14;
81         commission:=3;            
82         goto next2@;
83     end;        
84     
85     if strcmp(label,\'M\')=0 then begin        
86         pricelimit:=0.06;    
87         marginlevel:=0.15;
88         commission:=5;                
89         goto next2@;
90     end;
91         
92     if strcmp(label,\'Y\')=0 then begin
93         pricelimit:=0.06;    
94         marginlevel:=0.15;
95         commission:=8;            
96         goto next2@;
97     end;
98     
99     if strcmp(label,\'L\')=0 then begin
100         pricelimit:=0.06;    
101         marginlevel:=0.16;
102         commission:=12;        
103         goto next2@;
104     end;    
105     
106     if strcmp(label,\'P\')=0 then begin
107         pricelimit:=0.06;
108         marginlevel:=0.16;
109         commission:=6;        
110         goto next2@;
111     end;
112     
113     if strcmp(label,\'V\')=0 then begin
114         pricelimit:=0.06;     
115         marginlevel:=0.16;
116         commission:=12;            
117         goto next2@;
118     end;
119 end;
120
121 if strcmp(marketlabel,\'ZQ\')=0 then begin
122     label:=strleft(stklabel,2);
123     
124     if strcmp(label,\'WT\')=0 then begin
125         pricelimit:=0.06;    
126         marginlevel:=0.15;
127         commission:=3;                
128         goto next2@;
129     end;
130     
131     if strcmp(label,\'WS\')=0 then begin
132         pricelimit:=0.06;    
133         marginlevel:=0.14;
134         commission:=3;            
135         goto next2@;
136     end;
137     
138     if strcmp(label,\'ER\')=0 then begin
139         pricelimit:=0.06;    
140         marginlevel:=0.16;
141         commission:=3;            
142         goto next2@;
143     end;
144     
145     if strcmp(label,\'CF\')=0 then begin
146         pricelimit:=0.06;    
147         marginlevel:=0.17;
148         commission:=12;    
149         goto next2@;
150     end;                
151     
152     if strcmp(label,\'SR\')=0 then begin
153         pricelimit:=0.06;    
154         marginlevel:=0.17;
155         commission:=6;
156         goto next2@;
157     end;
158     
159     if strcmp(label,\'TA\')=0 then begin
160         pricelimit:=0.06;    
161         marginlevel:=0.16;
162         commission:=8;    
163         goto next2@;
164     end;
165     
166     if strcmp(label,\'RO\')=0 then begin
167         pricelimit:=0.06;    
168         marginlevel:=0.16;
169         commission:=6;        
170         goto next2@;
171     end;
172 end;
173
174 if strcmp(marketlabel,\'ZJ\')=0 then begin
175     label:=strleft(stklabel,2);
176     
177     if strcmp(label,\'IF\')=0 then begin    
178         pricelimit:=0.1;
179         marginlevel:=0.2;    
180         commission:=0.008;
181         goto next3@;
182     end;
183 end;
184
185 next2@;
186
187 begintime:=time>=092000 and time<=145500;
188 endtime:=time>=150000;
189     
190 n:=barslast(time=090500)+1;
191 settlementprice:=if(time=150000,trimprice(sum(vol*close,n)/sum(vol,n)),0);
192 goto next4@;
193
194 next3@;
195
196 begintime:=time>=093000 and time<=151000;
197 endtime:=time>=151500;
198
199 n:=barslast(time=141500)+1;
200 settlementprice:=if(time=151500,trimprice(sum(vol*close,n)/sum(vol,n)),0);
201 goto next4@;
202
203 next4@;


--  作者:董小球
--  发布时间:2010/12/8 16:15:08
--  
这么复杂也写的出 厉害啊图片点击可在新窗口打开查看
--  作者:kx2u
--  发布时间:2011/8/2 6:53:15
--  

[此贴子已经被作者于2011-8-2 6:56:17编辑过]

--  作者:ainysyh
--  发布时间:2014/3/31 0:05:18
--  

这个公式这么多代码

 

哪个是输出的结算价呢


--  作者:jinzhe
--  发布时间:2014/3/31 9:49:52
--  
settlementprice
--  作者:lsg2005616
--  发布时间:2014/4/1 14:02:20
--  
加在软件上怎么通不过呀,请老师看一看
--  作者:jinzhe
--  发布时间:2014/4/1 14:16:55
--  
把前面的1,2,3这类序号去掉