Skip to content

Commit

Permalink
0.9.60 新增 CHOP 波动指数
Browse files Browse the repository at this point in the history
  • Loading branch information
zengbin93 committed Oct 29, 2024
1 parent f72c5f5 commit 961af60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 2 additions & 3 deletions czsc/utils/ta.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,12 +448,11 @@ def CHOP(high, low, close, **kwargs):
Calculation:
Default Inputs:
length=14, scalar=100, drift=1
HH = high.rolling(length).max()
LL = low.rolling(length).min()
ATR_SUM = SUM(ATR(drift), length)
CHOP = scalar * (LOG10(ATR_SUM) - LOG10(HH - LL))
CHOP /= LOG10(length)
CHOP = scalar * (LOG10(ATR_SUM) - LOG10(HH - LL)) / LOG10(length)
:param high: pd.Series, Series of 'high's
:param low: pd.Series, Series of 'low's
Expand Down
15 changes: 15 additions & 0 deletions examples/develop/测试TA技术指标计算.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys
import time

sys.path.insert(0, r"A:\ZB\git_repo\waditu\czsc")
import talib
from czsc.utils import ta
from czsc.connectors import cooperation as coo


df = coo.get_raw_bars(symbol="SFIC9001", freq="日线", fq="后复权", sdt="20100101", edt="20210301", raw_bars=False)


def test_CHOP():
df1 = df.copy()
df1["CHOP"] = ta.CHOP(df1["high"], df1["low"], df1["close"])

0 comments on commit 961af60

Please sign in to comment.