feat: add EPA (Ehlers Phasor Analysis) indicator - TASC Nov 2022

This commit is contained in:
Miha Kralj
2026-03-19 09:22:04 -07:00
parent cd150a6b36
commit c98b0e2a57
15 changed files with 1715 additions and 0 deletions
+1
View File
@@ -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])
+10
View File
@@ -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)
+10
View File
@@ -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
// ═══════════════════════════════════════════════════════════════════════