mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-07-29 02:07:42 +00:00
feat(dynamics): add PTA - Ehlers Precision Trend Analysis
TASC Sep 2024. Dual 2-pole Butterworth highpass bandpass for near-zero-lag trend extraction. HP(long) - HP(short) preserves cycles between shortPeriod and longPeriod. - Core: Pta.cs with O(1) streaming, Span batch, state rollback - Quantower: PtaIndicator adapter with LineSeries + SetValue - Tests: 31 lib + 11 Quantower (all passing) - Pine: pta.pine PineScript v6 reference - Docs: Pta.md canonical template v3 - Python: Exports.Generated.cs + _bridge.py + dynamics.py - Indexes: _sidebar.md, lib/_index.md, dynamics/_index.md, docs/indicators.md, docs/pinescript.md
This commit is contained in:
@@ -368,6 +368,7 @@ HAS_HTTRENDMODE = _bind("qtl_httrendmode", [_dp, _dp, _ci])
|
||||
HAS_ICHIMOKU = _bind("qtl_ichimoku", [_dp, _dp, _dp, _dp, _dp, _ci, _ci, _ci, _ci, _ci, _dp, _dp, _dp, _dp, _dp])
|
||||
HAS_IMPULSE = _bind("qtl_impulse", [_dp, _ci, _ci, _ci, _ci, _ci, _dp])
|
||||
HAS_PFE = _bind("qtl_pfe", [_dp, _dp, _ci, _ci, _ci])
|
||||
HAS_PTA = _bind("qtl_pta", [_dp, _dp, _ci, _ci, _ci])
|
||||
HAS_QSTICK = _bind("qtl_qstick", [_dp, _dp, _dp, _dp, _dp, _ci, _ci, _ci, _dp])
|
||||
HAS_RAVI = _bind("qtl_ravi", [_dp, _dp, _ci, _ci, _ci])
|
||||
HAS_SUPER = _bind("qtl_super", [_dp, _dp, _dp, _dp, _dp, _ci, _cd, _ci, _dp])
|
||||
|
||||
@@ -266,6 +266,18 @@ def plus_dm(high: object, low: object, close: object, period: int = 14, offset:
|
||||
return _wrap(destination, idx, f"PLUS_DM_{period}", "dynamics", offset)
|
||||
|
||||
|
||||
def pta(close: object, longPeriod: int = 250, shortPeriod: int = 40, offset: int = 0, **kwargs) -> object:
|
||||
"""Ehlers Precision Trend Analysis."""
|
||||
longPeriod = int(kwargs.get("long_period", longPeriod))
|
||||
shortPeriod = int(kwargs.get("short_period", shortPeriod))
|
||||
offset = int(offset)
|
||||
src, idx = _arr(close)
|
||||
n = len(src)
|
||||
output = _out(n)
|
||||
_check(_lib.qtl_pta(_ptr(src), _ptr(output), n, longPeriod, shortPeriod))
|
||||
return _wrap(output, idx, f"PTA_{longPeriod}_{shortPeriod}", "dynamics", offset)
|
||||
|
||||
|
||||
def qstick(open: object, high: object, low: object, close: object, volume: object, period: int = 14, useEma: int = 0, offset: int = 0, **kwargs) -> object:
|
||||
"""QStick."""
|
||||
period = int(kwargs.get("length", period))
|
||||
|
||||
Reference in New Issue
Block a user