|
悬赏1金钱未解决
以下为我的DLL CPP源码
__declspec(dllexport) int WINAPI MMXH(CALCINFO* pData)
{
if ( pData->m_pCalcParam[0].m_nParamStart >= 0 &&
pData->m_pCalcParam[1].m_nParamStart >= 0 &&
pData->m_pCalcParam[2].m_nParamStart >= 0 &&
pData->m_pCalcParam[3].m_nParamStart >= 0 &&
pData->m_pCalcParam[4].m_nParamStart >= 0 &&
pData->m_pCalcParam[5].m_nParamStart >= 0 &&
pData->m_pCalcParam[6].m_nParamStart >= 0 &&
pData->m_pCalcParam[7].m_nParamStart >= 0 &&
pData->m_pCalcParam[8].m_nParamStart >= 0 &&
pData->m_pCalcParam[9].m_nParamStart >= 0 &&
pData->m_pCalcParam[10].m_nParamStart >= 0 &&
pData->m_pCalcParam[11].m_nParamStart >= 0 &&
pData->m_pCalcParam[12].m_nParamStart >= 0 &&
pData->m_pCalcParam[13].m_nParamStart >= 0 &&
pData->m_pCalcParam[14].m_nParamStart >= 0 &&
pData->m_pCalcParam[15].m_nParamStart >= 0 )
{
int nFirst = pData->m_pCalcParam[15].m_nParamStart;
const float* pValue1 = pData->m_pCalcParam[0].m_pfParam;
const float* pValue2 = pData->m_pCalcParam[1].m_pfParam;
const float* pValue3 = pData->m_pCalcParam[2].m_pfParam;
const float* pValue4 = pData->m_pCalcParam[3].m_pfParam;
const float* pValue5 = pData->m_pCalcParam[4].m_pfParam;
const float* pValue6 = pData->m_pCalcParam[5].m_pfParam;
const float* pValue7 = pData->m_pCalcParam[6].m_pfParam;
const float* pValue8 = pData->m_pCalcParam[7].m_pfParam;
const float* pValue9 = pData->m_pCalcParam[8].m_pfParam;
const float* pValue10 = pData->m_pCalcParam[9].m_pfParam;
const float* pValue11 = pData->m_pCalcParam[10].m_pfParam;
const float* pValue12 = pData->m_pCalcParam[11].m_pfParam;
const float* pValue13 = pData->m_pCalcParam[12].m_pfParam;
const float* pValue14 = pData->m_pCalcParam[13].m_pfParam;
const float* pValue15 = pData->m_pCalcParam[14].m_pfParam;
const float* pValue16 = pData->m_pCalcParam[15].m_pfParam;
for( int i = pData->m_nNumData-240; i < pData->m_nNumData; i++ )
{
if(i==pData->m_nNumData-1) {
float a[] = {pValue1[i],pValue2[i],pValue3[i],pValue4[i],pValue5[i],pValue6[i],pValue7[i],pValue8[i]};
float b[] = {pValue9[i],pValue10[i],pValue11[i],pValue12[i],pValue13[i],pValue14[i],pValue15[i],pValue16[i]};
int qq = 0,ss = 0;
for (int pp = 0 ; pp <7; pp++)
{ if(a[pp]>0 )
{qq = pp+1;
if(qq<5 )
{ time_t rawtime;
time ( &rawtime );
ofstream kd;
kd.open("signal.txt",ios::app);
kd <<"buy qq"<<qq<<" "<<i<<" "<<ctime(&rawtime);
kd.close();
}if(qq>4 )
{ time_t rawtime;
time ( &rawtime );
ofstream kkd;
kkd.open("signal.txt",ios::app);
kkd <<"sell qq"<<qq<<" "<<i<<" "<<ctime(&rawtime);
kkd.close();
}
}
}
for (int tt = 0 ; tt <7; tt++)
{ if(b[tt]>0 )
{ss= tt+1;
time_t rawtime;
time ( &rawtime );
ofstream pc;
pc.open("signal.txt",ios::app);
pc <<"pc ss"<<ss<<" "<<i<<" "<<ctime(&rawtime);
pc.close();
}
}
}
pData->m_pResultBuf[i] = i;
}
return nFirst;
}
return -1;
}
共8 个买卖信号,加上相对应平仓信号 共16个
我用两个数组来处理
数组a为8个买卖信号 b为8个买卖信号对应的平仓信号
现在的状况是
a中信号在1分钟中因分笔数据刷新而重复 出现
如下面的信号
sell qq6 2751 Fri Jan 13 10:06:01 2012
sell qq6 2751 Fri Jan 13 10:06:02 2012
sell qq6 2751 Fri Jan 13 10:06:03 2012
sell qq6 2751 Fri Jan 13 10:06:03 2012
sell qq6 2751 Fri Jan 13 10:06:04 2012
sell qq6 2751 Fri Jan 13 10:06:04 2012
sell qq6 2751 Fri Jan 13 10:06:05 2012
sell qq6 2751 Fri Jan 13 10:06:05 2012
sell qq6 2751 Fri Jan 13 10:06:06 2012
sell qq6 2751 Fri Jan 13 10:06:06 2012
sell qq6 2751 Fri Jan 13 10:06:07 2012
sell qq6 2751 Fri Jan 13 10:06:07 2012
sell qq6 2751 Fri Jan 13 10:06:08 2012
sell qq6 2751 Fri Jan 13 10:06:08 2012
sell qq6 2751 Fri Jan 13 10:06:09 2012
sell qq6 2751 Fri Jan 13 10:06:09 2012
sell qq6 2751 Fri Jan 13 10:06:10 2012
sell qq6 2751 Fri Jan 13 10:06:10 2012
sell qq6 2751 Fri Jan 13 10:06:11 2012
sell qq6 2751 Fri Jan 13 10:06:11 2012
sell qq6 2751 Fri Jan 13 10:06:12 2012
sell qq6 2751 Fri Jan 13 10:06:12 2012
sell qq6 2751 Fri Jan 13 10:06:13 2012
sell qq6 2751 Fri Jan 13 10:06:13 2012
sell qq6 2751 Fri Jan 13 10:06:14 2012
sell qq6 2751 Fri Jan 13 10:06:14 2012
sell qq6 2751 Fri Jan 13 10:06:15 2012
sell qq6 2751 Fri Jan 13 10:06:15 2012
sell qq6 2751 Fri Jan 13 10:06:16 2012
sell qq6 2751 Fri Jan 13 10:06:16 2012
sell qq6 2751 Fri Jan 13 10:06:17 2012
sell qq6 2751 Fri Jan 13 10:06:18 2012
sell qq6 2751 Fri Jan 13 10:06:18 2012
sell qq6 2751 Fri Jan 13 10:06:19 2012
sell qq6 2751 Fri Jan 13 10:06:19 2012
sell qq6 2751 Fri Jan 13 10:06:20 2012
sell qq6 2751 Fri Jan 13 10:06:20 2012
sell qq6 2751 Fri Jan 13 10:06:21 2012
sell qq6 2751 Fri Jan 13 10:06:21 2012
sell qq6 2751 Fri Jan 13 10:06:22 2012
sell qq6 2751 Fri Jan 13 10:06:22 2012
sell qq6 2751 Fri Jan 13 10:06:23 2012
sell qq6 2751 Fri Jan 13 10:06:23 2012
sell qq6 2751 Fri Jan 13 10:06:24 2012
sell qq6 2751 Fri Jan 13 10:06:24 2012
sell qq6 2751 Fri Jan 13 10:06:25 2012
sell qq6 2751 Fri Jan 13 10:06:25 2012
sell qq6 2751 Fri Jan 13 10:06:26 2012
sell qq6 2751 Fri Jan 13 10:06:26 2012
sell qq6 2751 Fri Jan 13 10:06:27 2012
sell qq6 2751 Fri Jan 13 10:06:27 2012
sell qq6 2751 Fri Jan 13 10:06:28 2012
sell qq6 2751 Fri Jan 13 10:06:28 2012
sell qq6 2751 Fri Jan 13 10:06:29 2012
sell qq6 2751 Fri Jan 13 10:06:29 2012
sell qq6 2751 Fri Jan 13 10:06:30 2012
sell qq6 2751 Fri Jan 13 10:06:30 2012
sell qq6 2751 Fri Jan 13 10:06:31 2012
sell qq6 2751 Fri Jan 13 10:06:31 2012
sell qq6 2751 Fri Jan 13 10:06:32 2012
sell qq6 2751 Fri Jan 13 10:06:32 2012
sell qq6 2751 Fri Jan 13 10:06:33 2012
sell qq6 2751 Fri Jan 13 10:06:33 2012
sell qq6 2751 Fri Jan 13 10:06:34 2012
sell qq6 2751 Fri Jan 13 10:06:34 2012
sell qq6 2751 Fri Jan 13 10:06:35 2012
sell qq6 2751 Fri Jan 13 10:06:36 2012
sell qq6 2751 Fri Jan 13 10:06:36 2012
sell qq6 2751 Fri Jan 13 10:06:37 2012
sell qq6 2751 Fri Jan 13 10:06:37 2012
sell qq6 2751 Fri Jan 13 10:06:38 2012
sell qq6 2751 Fri Jan 13 10:06:38 2012
sell qq6 2751 Fri Jan 13 10:06:39 2012
sell qq6 2751 Fri Jan 13 10:06:39 2012
sell qq6 2751 Fri Jan 13 10:06:40 2012
sell qq6 2751 Fri Jan 13 10:06:40 2012
sell qq6 2751 Fri Jan 13 10:06:41 2012
sell qq6 2751 Fri Jan 13 10:06:41 2012
sell qq6 2751 Fri Jan 13 10:06:42 2012
sell qq6 2751 Fri Jan 13 10:06:42 2012
sell qq6 2751 Fri Jan 13 10:06:43 2012
sell qq6 2751 Fri Jan 13 10:06:43 2012
sell qq6 2751 Fri Jan 13 10:06:44 2012
sell qq6 2751 Fri Jan 13 10:06:44 2012
sell qq6 2751 Fri Jan 13 10:06:45 2012
sell qq6 2751 Fri Jan 13 10:06:46 2012
sell qq6 2751 Fri Jan 13 10:06:46 2012
sell qq6 2751 Fri Jan 13 10:06:47 2012
sell qq6 2751 Fri Jan 13 10:06:47 2012
sell qq6 2751 Fri Jan 13 10:06:48 2012
sell qq6 2751 Fri Jan 13 10:06:48 2012
sell qq6 2751 Fri Jan 13 10:06:49 2012
sell qq6 2751 Fri Jan 13 10:06:49 2012
sell qq6 2751 Fri Jan 13 10:06:50 2012
sell qq6 2751 Fri Jan 13 10:06:50 2012
sell qq6 2751 Fri Jan 13 10:06:51 2012
sell qq6 2751 Fri Jan 13 10:06:51 2012
sell qq6 2751 Fri Jan 13 10:06:52 2012
sell qq6 2751 Fri Jan 13 10:06:52 2012
sell qq6 2751 Fri Jan 13 10:06:53 2012
sell qq6 2751 Fri Jan 13 10:06:53 2012
sell qq6 2751 Fri Jan 13 10:06:54 2012
sell qq6 2751 Fri Jan 13 10:06:54 2012
sell qq6 2751 Fri Jan 13 10:06:55 2012
sell qq6 2751 Fri Jan 13 10:06:55 2012
sell qq6 2751 Fri Jan 13 10:06:56 2012
sell qq6 2751 Fri Jan 13 10:06:56 2012
sell qq6 2751 Fri Jan 13 10:06:57 2012
sell qq6 2751 Fri Jan 13 10:06:57 2012
sell qq6 2751 Fri Jan 13 10:06:58 2012
sell qq6 2751 Fri Jan 13 10:06:58 2012
sell qq6 2751 Fri Jan 13 10:06:59 2012
sell qq6 2751 Fri Jan 13 10:06:59 2012
sell qq6 2751 Fri Jan 13 10:07:00 2012
sell qq6 2751 Fri Jan 13 10:07:00 2012
sell qq6 2751 Fri Jan 13 10:07:01 2012
sell qq6 2751 Fri Jan 13 10:07:01 2012
sell qq6 2752 Fri Jan 13 10:07:02 2012
sell qq6 2752 Fri Jan 13 10:07:02 2012
sell qq6 2752 Fri Jan 13 10:07:03 2012
现在要求
1:只能在一分钟出现一次 并且是第一次出现那个信号
2:b中的平仓的要求是a中的最后一个信号所对应的才能出现 也是 只能在一分钟出现一次 并且是第一次出现那个信号
3:以上1,2要求的信号写入TXT文件(如上面CPP中所示)
4:在处理1分钟过滤信号时不能频繁读写TXT文件(这个我已作过 效率太差 CPU使用过高)
附飞狐DLL公式接口规范 |
附件: 您需要 登录 才可以下载或查看,没有账号?加入
|