1 Star 0 Fork 43

王平/ChanlunX

forked from rubikplanet/ChanlunX 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Bi.cpp 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
rubikplanet 提交于 2021-10-09 22:16 . 使用std::vector
#include <iostream>
#include <fstream>
#include "Bi.h"
#include "KxianChuLi.h"
#include "BiChuLi.h"
using namespace std;
std::vector<float> Bi1(int nCount, std::vector<float> pHigh, std::vector<float> pLow)
{
std::vector<float> pOut(nCount);
KxianChuLi kxianChuLi;
for (int i = 0; i < nCount; i++)
{
kxianChuLi.add(pHigh[i], pLow[i]);
}
for (unsigned int i = 1; i < kxianChuLi.kxianList.size(); i++)
{
if (kxianChuLi.kxianList.at(i - 1).fangXiang != kxianChuLi.kxianList.at(i).fangXiang)
{
if (kxianChuLi.kxianList.at(i - 1).fangXiang == 1)
{
pOut[kxianChuLi.kxianList.at(i - 1).zhongJian] = 1;
}
else if (kxianChuLi.kxianList.at(i - 1).fangXiang == -1)
{
pOut[kxianChuLi.kxianList.at(i - 1).zhongJian] = -1;
}
}
}
if (kxianChuLi.kxianList.back().fangXiang == 1)
{
pOut[kxianChuLi.kxianList.back().zhongJian] = 1;
}
else if (kxianChuLi.kxianList.back().fangXiang == -1)
{
pOut[kxianChuLi.kxianList.back().zhongJian] = -1;
}
return pOut;
}
std::vector<float> Bi2(int nCount, std::vector<float> pHigh, std::vector<float> pLow)
{
std::vector<float> pOut(nCount);
KxianChuLi kxianChuLi;
for (int i = 0; i < nCount; i++)
{
kxianChuLi.add(pHigh[i], pLow[i]);
}
BiChuLi biChuLi;
biChuLi.handle(kxianChuLi.kxianList);
for (vector<Bi>::iterator iter = biChuLi.biList.begin(); iter != biChuLi.biList.end(); iter++)
{
if ((*iter).fangXiang == 1)
{
pOut[(*iter).kxianList.back().zhongJian] = 1;
}
else if ((*iter).fangXiang == -1)
{
pOut[(*iter).kxianList.back().zhongJian] = -1;
}
}
return pOut;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wang-ping241/ChanlunX.git
git@gitee.com:wang-ping241/ChanlunX.git
wang-ping241
ChanlunX
ChanlunX
master

搜索帮助