diff --git a/hikyuu_cpp/hikyuu/indicator/imp/IHhvbars.cpp b/hikyuu_cpp/hikyuu/indicator/imp/IHhvbars.cpp index 48741266..afb46e3d 100644 --- a/hikyuu_cpp/hikyuu/indicator/imp/IHhvbars.cpp +++ b/hikyuu_cpp/hikyuu/indicator/imp/IHhvbars.cpp @@ -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) { diff --git a/hikyuu_cpp/hikyuu/indicator/imp/IHighLine.cpp b/hikyuu_cpp/hikyuu/indicator/imp/IHighLine.cpp index 2d6623ef..cfc6b177 100644 --- a/hikyuu_cpp/hikyuu/indicator/imp/IHighLine.cpp +++ b/hikyuu_cpp/hikyuu/indicator/imp/IHighLine.cpp @@ -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; } diff --git a/hikyuu_cpp/hikyuu/indicator/imp/ILowLine.cpp b/hikyuu_cpp/hikyuu/indicator/imp/ILowLine.cpp index 14613c47..48488e94 100644 --- a/hikyuu_cpp/hikyuu/indicator/imp/ILowLine.cpp +++ b/hikyuu_cpp/hikyuu/indicator/imp/ILowLine.cpp @@ -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) { diff --git a/hikyuu_cpp/hikyuu/indicator/imp/ILowLineBars.cpp b/hikyuu_cpp/hikyuu/indicator/imp/ILowLineBars.cpp index 346c78b6..bfcccdc2 100644 --- a/hikyuu_cpp/hikyuu/indicator/imp/ILowLineBars.cpp +++ b/hikyuu_cpp/hikyuu/indicator/imp/ILowLineBars.cpp @@ -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) { diff --git a/xmake.lua b/xmake.lua index edf59031..6a06fe3b 100644 --- a/xmake.lua +++ b/xmake.lua @@ -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"})