-
Notifications
You must be signed in to change notification settings - Fork 99
/
Main.cpp
216 lines (201 loc) · 7.21 KB
/
Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
#include "Main.h"
#include <iostream>
#include <fstream>
using namespace std;
//定义DLL程序的入口函数
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
//=============================================================================
// 输出函数1号:输出简笔顶底端点
//=============================================================================
void Func1(int nCount, float *pOut, float *pHigh, float *pLow, float *pIgnore)
{
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<float> out = Bi1(nCount, high, low);
memset(pOut, 0, nCount);
for (int i = 0; i < nCount; i++)
{
pOut[i] = out[i];
}
}
//=============================================================================
// 输出函数2号:输出标准笔顶底端点
//=============================================================================
void Func2(int nCount, float *pOut, float *pHigh, float *pLow, float *pIgnore)
{
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<float> out = Bi2(nCount, high, low);
memset(pOut, 0, nCount);
for (int i = 0; i < nCount; i++)
{
pOut[i] = out[i];
}
}
//=============================================================================
// 输出函数3号:输出段的端点标准画法
//=============================================================================
void Func3(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<float> out = Duan1(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (int i = 0; i < nCount; i++)
{
pOut[i] = out[i];
}
}
//=============================================================================
// 输出函数4号:输出段的端点1+1终结画法
//=============================================================================
void Func4(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<float> out = Duan2(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (int i = 0; i < nCount; i++)
{
pOut[i] = out[i];
}
}
//=============================================================================
// 输出函数5号:中枢高点数据
//=============================================================================
void Func5(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<Pivot> ZhongShuList = ZS(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (size_t i = 0; i < ZhongShuList.size(); i++)
{
Pivot ZhongShuOne = ZhongShuList.at(i);
for (int j = ZhongShuOne.s + 1; j <= ZhongShuOne.e - 1; j++)
{
pOut[j] = ZhongShuOne.zg;
}
}
}
//=============================================================================
// 输出函数6号:中枢低点数据
//=============================================================================
void Func6(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<Pivot> ZhongShuList = ZS(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (size_t i = 0; i < ZhongShuList.size(); i++)
{
Pivot ZhongShuOne = ZhongShuList.at(i);
for (int j = ZhongShuOne.s + 1; j <= ZhongShuOne.e - 1; j++)
{
pOut[j] = ZhongShuOne.zd;
}
}
}
//=============================================================================
// 输出函数7号:中枢起点、终点信号
//=============================================================================
void Func7(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<Pivot> ZhongShuList = ZS(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (size_t i = 0; i < ZhongShuList.size(); i++)
{
Pivot ZhongShuOne = ZhongShuList.at(i);
pOut[ZhongShuOne.s + 1] = 1;
pOut[ZhongShuOne.e - 1] = 2;
}
}
//=============================================================================
// 输出函数8号:中枢方向数据
//=============================================================================
void Func8(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<Pivot> ZhongShuList = ZS(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (size_t i = 0; i < ZhongShuList.size(); i++)
{
Pivot ZhongShuOne = ZhongShuList.at(i);
for (int j = ZhongShuOne.s + 1; j <= ZhongShuOne.e - 1; j++)
{
pOut[j] = (float)ZhongShuOne.direction;
}
}
}
//=============================================================================
// 输出函数9号:同方向的第几个中枢
//=============================================================================
void Func9(int nCount, float *pOut, float *pIn, float *pHigh, float *pLow)
{
std::vector<float> bi(pIn, pIn + nCount);
std::vector<float> high(pHigh, pHigh + nCount);
std::vector<float> low(pLow, pLow + nCount);
std::vector<Pivot> ZhongShuList = ZS(nCount, bi, high, low);
memset(pOut, 0, nCount);
for (size_t i = 0; i < ZhongShuList.size(); i++)
{
Pivot ZhongShuOne = ZhongShuList.at(i);
float c = 1;
for (int j = i - 1; j >= 0; j--)
{
if (ZhongShuList.at(j).direction == ZhongShuList.at(i).direction)
{
c++;
}
else
{
break;
}
}
for (int j = ZhongShuOne.s + 1; j <= ZhongShuOne.e - 1; j++)
{
pOut[j] = c;
}
}
}
static PluginTCalcFuncInfo Info[] =
{
{1, &Func1},
{2, &Func2},
{3, &Func3},
{4, &Func4},
{5, &Func5},
{6, &Func6},
{7, &Func7},
{8, &Func8},
{9, &Func9},
{0, NULL}};
BOOL RegisterTdxFunc(PluginTCalcFuncInfo **pInfo)
{
if (*pInfo == NULL)
{
*pInfo = Info;
return TRUE;
}
return FALSE;
}