fixed LLV/LLVBARS/HHVBARS

This commit is contained in:
fasiondog 2021-11-30 01:28:43 +08:00
parent 33fc74643d
commit 8389773f77
5 changed files with 40 additions and 46 deletions

View File

@ -63,29 +63,26 @@ void IHhvbars::_calculate(const Indicator& ind) {
_set(i - pre_pos, i);
}
for (size_t i = start_pos; i < total - 1; i++) {
for (size_t i = start_pos; i < total; i++) {
size_t j = i + 1 - n;
if (pre_pos < j) {
pre_pos = j;
max = ind[j];
}
if (ind[i] >= max) {
max = ind[i];
pre_pos = i;
for (size_t j = pre_pos + 1; j <= i; j++) {
if (ind[j] >= max) {
max = ind[j];
pre_pos = j;
}
}
} else {
if (ind[i] >= max) {
max = ind[i];
pre_pos = i;
}
}
_set(i - pre_pos, i);
}
start_pos = total - n;
max = ind[start_pos];
pre_pos = start_pos;
for (size_t i = start_pos; i < total; i++) {
if (ind[i] >= max) {
pre_pos = i;
max = ind[i];
}
}
_set(total - pre_pos - 1, total - 1);
}
Indicator HKU_API HHVBARS(int n) {

View File

@ -71,7 +71,7 @@ void IHighLine::_calculate(const Indicator& ind) {
pre_pos = j;
max = ind[j];
for (size_t j = pre_pos + 1; j <= i; j++) {
if (ind[j] > max) {
if (ind[j] >= max) {
max = ind[j];
pre_pos = j;
}

View File

@ -70,22 +70,20 @@ void ILowLine::_calculate(const Indicator& ind) {
if (pre_pos < j) {
pre_pos = j;
min = ind[j];
}
if (ind[i] <= min) {
min = ind[i];
pre_pos = i;
for (size_t j = pre_pos + 1; j <= i; j++) {
if (ind[j] <= min) {
min = ind[j];
pre_pos = j;
}
}
} else {
if (ind[i] <= min) {
min = ind[i];
pre_pos = i;
}
}
_set(min, i);
}
startPos = total - n;
min = ind[startPos];
for (size_t i = startPos; i < total; i++) {
if (ind[i] <= min) {
min = ind[i];
}
}
_set(min, total - 1);
}
Indicator HKU_API LLV(int n = 20) {

View File

@ -63,29 +63,25 @@ void ILowLineBars::_calculate(const Indicator& ind) {
_set(i - pre_pos, i);
}
for (size_t i = start_pos; i < total - 1; i++) {
for (size_t i = start_pos; i < total; i++) {
size_t j = i + 1 - n;
if (pre_pos < j) {
pre_pos = j;
min = ind[j];
}
if (ind[i] <= min) {
min = ind[i];
pre_pos = i;
for (size_t j = pre_pos + 1; j <= i; j++) {
if (ind[j] <= min) {
min = ind[j];
pre_pos = j;
}
}
} else {
if (ind[i] <= min) {
min = ind[i];
pre_pos = i;
}
}
_set(i - pre_pos, i);
}
start_pos = total - n;
min = ind[start_pos];
pre_pos = start_pos;
for (size_t i = start_pos; i < total; i++) {
if (ind[i] <= min) {
pre_pos = i;
min = ind[i];
}
}
_set(total - pre_pos - 1, total - 1);
}
Indicator HKU_API LLVBARS(int n) {

View File

@ -4,6 +4,9 @@ set_xmakever("2.5.4")
set_project("hikyuu")
add_rules("mode.debug", "mode.release")
if not is_plat("windows") then
add_rules("mode.coverage")
end
-- version
set_version("1.1.9", {build="%Y%m%d%H%M"})