diff --git a/config.h.in b/config.h.in index 58c72dbb..b4ff7ffc 100644 --- a/config.h.in +++ b/config.h.in @@ -121,7 +121,7 @@ #define HKU_DISABLE_ASSERT ${HKU_DISABLE_ASSERT} // 启用MSVC内存泄漏检查 -${define ENABLE_LEAK_DETECT} +#define ENABLE_MSVC_LEAK_DETECT ${ENABLE_MSVC_LEAK_DETECT} // clang-format on diff --git a/hikyuu/indicator/pyind.py b/hikyuu/indicator/pyind.py index 168de14a..752d6e7f 100644 --- a/hikyuu/indicator/pyind.py +++ b/hikyuu/indicator/pyind.py @@ -44,25 +44,4 @@ def KDJ(kdata=None, n=9, m1=3, m2=3): k.set_context(kdata) j.set_context(kdata) d.set_context(kdata) - return k, d, j - - -def RSI_PY(kdata=None, N1=6, N2=12, N3=24): - """相对强弱指标 - - :param KData kdata: 关联的K线数据 - :param int N1: 参数N1 - :param int N2: 参数N1 - :param int N3: 参数N1 - :return: rsi1, rsi2, rsi3 - """ - LC = REF(CLOSE(), 1) - rsi1 = SMA(MAX(CLOSE() - LC, 0), N1, 1) / SMA(ABS(CLOSE() - LC), N1, 1) * 100 - rsi2 = SMA(MAX(CLOSE() - LC, 0), N2, 1) / SMA(ABS(CLOSE() - LC), N2, 1) * 100 - rsi3 = SMA(MAX(CLOSE() - LC, 0), N3, 1) / SMA(ABS(CLOSE() - LC), N3, 1) * 100 - - if kdata is not None: - rsi1.set_context(kdata) - rsi2.set_context(kdata) - rsi3.set_context(kdata) - return rsi1, rsi2, rsi3 + return k, d, j \ No newline at end of file diff --git a/hikyuu_cpp/hikyuu/debug.h b/hikyuu_cpp/hikyuu/debug.h index d6525a08..70c129c4 100644 --- a/hikyuu_cpp/hikyuu/debug.h +++ b/hikyuu_cpp/hikyuu/debug.h @@ -9,7 +9,7 @@ #pragma once -#if defined(_MSC_VER) && (defined(_DEBUG) || defined(DEBUG)) && defined(ENABLE_LEAK_DETECT) +#if ENABLE_LEAK_DETECT && defined(_MSC_VER) && (defined(_DEBUG) || defined(DEBUG)) #ifndef MSVC_LEAKER_DETECT #define MSVC_LEAKER_DETECT #endif diff --git a/hikyuu_cpp/hikyuu/indicator/crt/RSI.h b/hikyuu_cpp/hikyuu/indicator/crt/RSI.h index fc1a5429..2de92d33 100644 --- a/hikyuu_cpp/hikyuu/indicator/crt/RSI.h +++ b/hikyuu_cpp/hikyuu/indicator/crt/RSI.h @@ -1,6 +1,6 @@ /* * RSI.h - * + * * Created on: 2023年09月23日 * Author: yangrq1018 */ @@ -19,7 +19,7 @@ namespace hku { * 相对强弱指数 * @ingroup Indicator */ -Indicator HKU_API RSI(int n = 14) { +Indicator RSI(int n = 14) { Indicator diff = REF(0) - REF(1); Indicator u = IF(diff > 0, diff, 0); Indicator d = IF(diff < 0, (-1) * diff, 0); @@ -36,4 +36,3 @@ Indicator HKU_API RSI(int n = 14) { } // namespace hku #endif /* INDICATOR_CRT_ABS_H_ */ - diff --git a/hikyuu_pywrap/indicator/_build_in.cpp b/hikyuu_pywrap/indicator/_build_in.cpp index 437cdaa0..11cbcfa6 100644 --- a/hikyuu_pywrap/indicator/_build_in.cpp +++ b/hikyuu_pywrap/indicator/_build_in.cpp @@ -426,8 +426,6 @@ Indicator (*SLICE_1)(const PriceList&, int64_t, int64_t) = SLICE; Indicator (*SLICE_2)(int64_t, int64_t, int) = SLICE; Indicator (*SLICE_3)(const Indicator&, int64_t, int64_t, int) = SLICE; -Indicator (*RSI_1)(int) = RSI; - void export_Indicator_build_in() { def("KDATA", KDATA1); def("KDATA", KDATA3, R"(KDATA([data]) @@ -1482,12 +1480,11 @@ void export_Indicator_build_in() { :param int end: 终止位置(不包含本身) :param int result_index: 原输入数据中的结果集)"); - def("RSI", RSI_1, (arg("n") = 14), R"(RSI([data, n=14]) + def("RSI", RSI, (arg("n") = 14), R"(RSI([data, n=14]) 相对强弱指数 :param Indicator data: 输入数据 :param int|Indicator|IndParam n: 时间窗口 :rtype: Indicator)"); - } diff --git a/xmake.lua b/xmake.lua index 08c1d4ec..3e98547a 100644 --- a/xmake.lua +++ b/xmake.lua @@ -27,7 +27,7 @@ set_configvar("SUPPORT_TEXT_ARCHIVE", 0) set_configvar("SUPPORT_XML_ARCHIVE", 1) set_configvar("SUPPORT_BINARY_ARCHIVE", 1) set_configvar("HKU_DISABLE_ASSERT", 0) -set_configvar("ENABLE_LEAK_DETECT", true) +set_configvar("ENABLE_MSVC_LEAK_DETECT", 0) -- set warning all as error if is_plat("windows") then