This commit is contained in:
fasiondog 2023-10-01 22:32:29 +08:00
parent 5e504d1d9e
commit 7f07f18a1c
6 changed files with 7 additions and 32 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,6 +1,6 @@
/*
* RSI.h
*
*
* Created on: 20230923
* 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_ */

View File

@ -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)");
}

View File

@ -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