mirror of
https://gitee.com/fasiondog/hikyuu.git
synced 2024-11-29 18:39:10 +08:00
调整 PR #114
This commit is contained in:
parent
5e504d1d9e
commit
7f07f18a1c
@ -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
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
@ -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_ */
|
||||
|
||||
|
@ -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)");
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user