[求助]求救DLL,求金大神指点 [金字塔]
- 咨询内容:
TCore::TCore( CALCINFO* pData,int x){
if ( pData->m_pfParam1 && pData->m_nParam1Start<0 &&
//参数1有效且为常数
pData->m_pfParam2 &&
pData->m_pfParam3 &&
pData->m_pfParam4)
{
float fParam = *pData->m_pfParam1;
slow= (int)fParam;
float fParam1 = *pData->m_pfParam2;
fast= (int)fParam1;
float fParam2 = *pData->m_pfParam3;
Mid= (int)fParam2;
float fParam3 = *pData->m_pfParam4;
MaSelect= (int)fParam3;
}
//数组初始化
DataLen=pData->m_nNumData; int realLen=DataLen+10;
H.resize(realLen,0);
L.resize(realLen,0);
MidHL.resize(realLen,0); RstArray.resize(realLen,0);
BL=6;
B.resize(realLen,0); D.resize(realLen,0); Macd.resize(realLen,0); Diff.resize(realLen,0); Dea.resize(realLen,0);
HB.resize(realLen,0); HD.resize(realLen,0); HMacd.resize(realLen,0); HDiff.resize(realLen,0); HDea.resize(realLen,0);
HHB.resize(realLen,0); HHD.resize(realLen,0); HHMacd.resize(realLen,0); HHDiff.resize(realLen,0); HHDea.resize(realLen,0);
//----------------------数组初始化 switch (MaSelect) { case 1: { initEmaData(pData,x); }; case 2:; case 3:; default:; }
init emaData
void TCore::initEmaData( CALCINFO* pData,int x){ float factorB=2.0f/(fast+1.0f); float factorD=2.0f/(slow+1.0f); float factorHB=2.0f/(fast*BL+1.0f); float factorHD=2.0f/(slow*BL+1.0f); float factorHHB=2.0f/(fast*BL*BL+1.0f); float factorHHD=2.0f/(slow*BL*BL+1.0f);
for(int i=0;i<DataLen;i++) { RstArray[i]=0;//类成员,临时结果缓存
H[i]=(pData->m_pData[i].m_fHigh); L[i]=(pData->m_pData[i].m_fLow);
MidHL[i]=(H[i]+L[i])*0.5f;
if(i==0) { B[i]=MidHL[0]; D[i]=MidHL[0]; Diff[i]=B[i]-D[i]; Dea[i]=Diff[i];
HB[i]=MidHL[0]; HD[i]=MidHL[0]; HDiff[i]=HB[i]-HD[i]; HDea[i]=HDiff[i];
HHB[i]=MidHL[0]; HHD[i]=MidHL[0]; HHDiff[i]=HHB[i]-HHD[i]; HHDea[i]=HHDiff[i]; } else { float A=MidHL[i]; B[i]=B[i-1]+factorB*(A-B[i-1]); D[i]=D[i-1]+factorD*(A-D[i-1]); Diff[i]=B[i]-D[i]; float factorDea=2.0f/(Mid+1.0f); Dea[i]=Dea[i-1]+factorDea*(Diff[i]-Dea[i-1]); Macd[i]=2.0f*(Diff[i]-Dea[i]);
HB[i]=HB[i-1]+factorHB*(A-HB[i-1]); HD[i]=HD[i-1]+factorHD*(A-HD[i-1]); HDiff[i]=HB[i]-HD[i]; float factorHDea=2.0f/(Mid*BL+1.0f); HDea[i]=HDea[i-1]+factorHDea*(HDiff[i]-HDea[i-1]); HMacd[i]=2.0f*(HDiff[i]-HDea[i]);
HHB[i]=HHB[i-1]+factorHHB*(A-HHB[i-1]); HHD[i]=HHD[i-1]+factorHHD*(A-HHD[i-1]); HHDiff[i]=HHB[i]-HHD[i]; float factorHHDea=2.0f/(Mid*BL*BL+1.0f); HHDea[i]=HHDea[i-1]+factorHHDea*(HHDiff[i]-HHDea[i-1]); HHMacd[i]=2.0f*(HHDiff[i]-HHDea[i]); } }
if(x==-1) { for(int i=0;i<DataLen;i++) { L[i]=(100000-pData->m_pData[i].m_fHigh); H[i]=(100000-pData->m_pData[i].m_fLow);
Diff[i]=-1*Diff[i]; Dea[i]=-1*Dea[i]; Macd[i]=-1*Macd[i];
HDiff[i]=-1*HDiff[i]; HDea[i]=-1*HDea[i]; HMacd[i]=-1*HMacd[i];
HHDiff[i]=-1*HHDiff[i]; HHDea[i]=-1*HHDea[i]; HHMacd[i]=-1*HHMacd[i]; } }
extern "C" __declspec(dllexport) int WINAPI OPSUP(CALCINFO* pData){ TCore Core(pData,1); Core.CalCore(); for(int m=0;m<pData->m_nNumData;m++) { pData->m_pResultBuf[m] =Core.L[m]; } return 0; Core.~TCore();
return -1; }
为什么core.L赋值每间隔几根就会不赋值,求金字塔大神解救!多谢!
- 金字塔客服:
有经验的编程人员会利用写文件日志的方式来调试你自己的代码
- 用户回复: 那你能帮我看下,为什么会赋值有间隔?谢了
有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友
可联系技术人员 QQ: 1145508240 进行 有偿 编写!(不贵!点击查看价格!)
相关文章
-
没有相关内容