mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-04 20:17:43 +00:00
feat: add EPA (Ehlers Phasor Analysis) indicator - TASC Nov 2022
This commit is contained in:
@@ -577,6 +577,7 @@ HAS_ACP = _bind("qtl_acp", [_dp, _ci, _dp, _ci, _ci, _ci, _ci])
|
||||
HAS_LPF = _bind("qtl_lpf", [_dp, _ci, _dp, _ci, _ci, _ci])
|
||||
HAS_AMFM = _bind("qtl_amfm", [_dp, _dp, _ci, _dp, _dp, _ci])
|
||||
HAS_FSI = _bind("qtl_fsi", [_dp, _ci, _dp, _ci, _cd])
|
||||
HAS_EPA = _bind("qtl_epa", [_dp, _ci, _dp, _ci])
|
||||
|
||||
# ── Numerics (Exports.cs — manual) ──
|
||||
HAS_CHANGE = _bind("qtl_change", [_dp, _ci, _dp, _ci])
|
||||
|
||||
@@ -24,6 +24,7 @@ __all__ = [
|
||||
"acp",
|
||||
"amfm",
|
||||
"fsi",
|
||||
"epa",
|
||||
]
|
||||
|
||||
|
||||
@@ -182,3 +183,12 @@ def fsi(close: object, period: int = 20, bandwidth: float = 0.1,
|
||||
src, idx = _arr(close); n = len(src); dst = _out(n)
|
||||
_check(_lib.qtl_fsi(_ptr(src), n, _ptr(dst), period, float(bandwidth)))
|
||||
return _wrap(dst, idx, f"FSI_{period}", "cycles", offset)
|
||||
|
||||
|
||||
def epa(close: object, period: int = 28,
|
||||
offset: int = 0, **kwargs) -> object:
|
||||
"""Ehlers Phasor Analysis."""
|
||||
period = int(kwargs.get("length", period)); offset = int(offset)
|
||||
src, idx = _arr(close); n = len(src); dst = _out(n)
|
||||
_check(_lib.qtl_epa(_ptr(src), n, _ptr(dst), period))
|
||||
return _wrap(dst, idx, f"EPA_{period}", "cycles", offset)
|
||||
|
||||
@@ -1566,6 +1566,16 @@ public static unsafe partial class Exports
|
||||
catch { return StatusCodes.QTL_ERR_INTERNAL; }
|
||||
}
|
||||
|
||||
// Epa: Pattern A (src → dst, int period)
|
||||
[UnmanagedCallersOnly(EntryPoint = "qtl_epa")]
|
||||
public static int QtlEpa(double* src, int n, double* dst, int period)
|
||||
{
|
||||
int v = Chk1(src, dst, n); if (v != 0) return v;
|
||||
v = ChkPeriod(period); if (v != 0) return v;
|
||||
try { Epa.Batch(Src(src, n), Dst(dst, n), period); return StatusCodes.QTL_OK; }
|
||||
catch { return StatusCodes.QTL_ERR_INTERNAL; }
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// §8.14 Numerics / transforms
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user