悟多公式DLL部分源码
这个已经超出了证券软件自带编程函数外的东东
如果这里有计算机软件编程专业的应该一看就懂
但如果会计算机编程如果对缠师的文章理解不了或着说千人千缠
用计算机编程语言去写也就不一定是原味了
1处理kxian顶底的源代码
2
3function kxian(pData:pT agCALCINFO):integer;stdcall;export;
4const quekou:single=0.005;
5var
6i,j,k,m,n:integer;
7h,h1,h2,h3,h4,h5,h6,h7:single;
8tj1,tj2,tj3,tj4:boolean;
9begin
10
11if (@pData.m_pfParam1 <> nil) and (@pData.m_pfParam2 <> nil) then 12begin
13adjustkline(pdata); //处理包含关系;
14firstduan:=true;
15prtype:=pdata^.m_dataType;
16
17case prtype of
18MIN1_DATA: //1
19biquekou:=quekou;
20MIN5_DATA: //5
21biquekou:=quekou*3;
22MIN15_DATA: //15
23biquekou:=Quekou*6 ;
24MIN30_DATA: //30
25biquekou:=quekou*9;
26MIN60 60
27biquekou:=quekou*18;
28DAY_DATA: //day
29biquekou:=quekou*30;
30WEEK_DATA: //周线
31biquekou:=quekou*90;
32MONTH_DATA:
33biquekou:=quekou*250;
34YEAR_DATA:
35biquekou:=quekou*1000;
36MULTIday_DATA:
37biquekou:=quekou*500;
38MULTmin_DATA:
39biquekou:=quekou*20;
40else
41biquekou:=quekou*500;
42
43end;
44//标出顶和底
45pr[0].flag:=0;
46pr[prnum-1].flag:=0;
47for i:=1 to prnum-2 do
48begin
49
50h:=pr.hprice;
51j:=i-1;
52h1:=pr[j].hprice;
53while (h=h1) and (j>0) do//取前一个不同的高值
54begin
55j:=j-1;
56h1:=pr[j].hprice;
57end;
58m:=j;
59if j>0 then j:=j-1;
60h2:=pr[j].hprice;
61
62while (h1=h2) and (j>0) do//最前2个不同的值
63begin
64j:=j-1;
65h2:=pr[j].hprice;
66end;
67if j>0 then j:=j-1;
68h3:=pr[j].hprice;
69while (h2=h3) and (j>0) do//取前3个不同的值
70begin
71j:=j-1;
72h3:=pr[j].hprice;
73end;
74
75
76k:=i+1;
77h4:=pr[k].hprice;
h5平台源码下载78while (h=h4) and (k<prnum-1) do //后一个不同高值79begin
80k:=k+1;
81h4:=pr[k].hprice;
82end;
83n:=k;
84if (k<prnum-1) then k:=k+1;
85h5:=pr[k].hprice;
86while (h4=h5) and (k<prnum-1) do //后2个不同高值
87begin
88k:=k+1;
89h5:=pr[k].hprice;
90end;
91if (k<prnum-1) then k:=k+1;
92h6:=pr[k].hprice;
93while (h5=h6) and (k<prnum-1) do //后3个不同高值
94begin
95k:=k+1;
96h6:=pr[k].hprice;
97end;
98if (k>=prnum) or (n+3>=prnum) then break;
99
100tj1:=false;tj2:=false;
101tj3:=false;tj4:=false;
102if (h>=h1) and (h>=h2) and (h>=h3) and (h>=h4)
103and (h>=h5) and (h>=h6) then //判断顶底
104tj1:=true;
105
106if m>=3 then h7:=pr[m-3].hprice else h7:=pr[0].hprice; 107
108if (h>=h1) and (h>=h2) and
109(h>=h3) and (h>=h7) and
110(h>=pr[n].hprice) and (h>=pr[n+1].hprice) and
111(h>=pr[n+2].hprice) and (h>=pr[n+3].hprice) then
112tj2:=true;
113
114if not (tj1 and tj2) then
115begin
116
117h:=pr.lprice;
118j:=i-1;
119h1:=pr[j].lprice;
120while (h=h1) and (j>0) do//取前一个不同的低值
121begin
122j:=j-1;
123h1:=pr[j].lprice;
124end;
125m:=j;
126if j>0 then j:=j-1;
127h2:=pr[j].lprice;
128while (h1=h2) and (j>0) do//最前2个不同的值
129begin
130j:=j-1;
131h2:=pr[j].lprice;
132end;
133if j>0 then j:=j-1;
134h3:=pr[j].lprice;
135while (h2=h3) and (j>0) do//取前3个不同的值
136begin
137j:=j-1;
138h3:=pr[j].lprice;
139end;
140
141
142
143k:=i+1;
144h4:=pr[k].lprice;
145while (h=h4) and (k<prnum-1) do //后1个不同低值
146begin
147k:=k+1;
148h4:=pr[k].lprice;
149end;
150n:=k;
151if (k<prnum-1) then k:=k+1;
152h5:=pr[k].lprice;
153while (h4=h5) and (k<prnum-1) do //后2个不同高值
154begin
155k:=k+1;
156h5:=pr[k].lprice;
157end;
158if (k<prnum-1) then k:=k+1;
159h6:=pr[k].lprice;
160while (h5=h6) and (k<prnum-1) do //后3个不同高值
161begin
162k:=k+1;
163h6:=pr[k].lprice;
164end;
165if (k>=prnum) or (n+3>=prnum) then break;
166
167if (h<=h1) and (h<=h2) and (h<=h3) and (h<=h4) 168and (h<=h5) and (h<=h6) then //判断底
169tj3:=true;
170
171if m>=3 then h7:=pr[m-3].lprice else h7:=pr[0].lprice;
172
173if (h<=h1) and (h<=h2) and (h<=h3) and (h<=h7) and 174(h<=pr[n].lprice) and (h<=pr[n+1].lprice) and
175(h<=pr[n+2].lprice) and (h<=pr[n+3].lprice) then
176tj4:=true;
177end;
178
179if tj1 and tj2 then
180pr.flag:=1
181else
182if tj3 and tj4 then
183pr.flag:=-1
184else
185pr.flag:=0;
186
187end;//end for
188
189
190for i:=1 to prnum-2 do //检查几个包含后重复的。
191begin
192
193
194m:=pr.flag;
195if m= 1 then
196begin
197if pdata^.m_pData.m_fHigh=pr.hprice then
198begin
199pr.flag:=1;
200j:=i+1; //如果前面的相同,只标最后一个
201h:=pr[j].hprice;
202while (h=pr.hprice) and (j<prnum-1) do
203begin
204j:=j+1;
205h:=pr[j].hprice;
206end;
207for k:=i+1 to (j-1) do
208begin
209pr[k].flag:=0;
210end;
211end
212else
213pr.flag:=0;
214end;
215if m= -1 then

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。