fix(frama): rewire Python export to use H/L arrays instead of single source

This commit is contained in:
Miha Kralj
2026-03-02 15:56:12 -08:00
parent fbdc9172cc
commit c23fbbd99f
3 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -166,7 +166,7 @@ HAS_RWMA = _bind("qtl_rwma", [_dp, _dp, _dp, _dp, _ci, _ci])
# Trends — IIR
# ═══════════════════════════════════════════════════════════════════════════
HAS_ADXVMA = _bind("qtl_adxvma", [_dp, _dp, _dp, _dp, _dp, _ci, _ci, _dp])
HAS_FRAMA = _bind("qtl_frama", [_dp, _dp, _ci, _ci])
HAS_FRAMA = _bind("qtl_frama", [_dp, _dp, _dp, _ci, _ci])
HAS_HOLT = _bind("qtl_holt", [_dp, _dp, _ci, _ci, _cd])
HAS_HTIT = _bind("qtl_htit", [_dp, _dp, _ci])
HAS_HWMA = _bind("qtl_hwma", [_dp, _dp, _ci, _ci])
+4 -4
View File
@@ -63,14 +63,14 @@ def adxvma(open: object, high: object, low: object, close: object, volume: objec
return _wrap(dst, idx, f"ADXVMA_{period}", "trends_iir", offset)
def frama(close: object, period: int = 14, offset: int = 0, **kwargs) -> object:
def frama(high: object, low: object, period: int = 14, offset: int = 0, **kwargs) -> object:
"""Fractal Adaptive Moving Average."""
period = int(kwargs.get("length", period))
offset = int(offset)
src, idx = _arr(close)
n = len(src)
h, idx = _arr(high); l, _ = _arr(low)
n = len(h)
output = _out(n)
_check(_lib.qtl_frama(_ptr(src), _ptr(output), n, period))
_check(_lib.qtl_frama(_ptr(h), _ptr(l), _ptr(output), n, period))
return _wrap(output, idx, f"FRAMA_{period}", "trends_iir", offset)
+3 -3
View File
@@ -575,13 +575,13 @@ public static unsafe partial class Exports
}
[UnmanagedCallersOnly(EntryPoint = "qtl_frama")]
public static int QtlFrama(double* source, double* output, int n, int period)
public static int QtlFrama(double* high, double* low, double* output, int n, int period)
{
if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR;
if (high == null || low == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR;
if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH;
try
{
Frama.Batch(Src(source, n), Dst(output, n), period);
Frama.Batch(Src(high, n), Src(low, n), period, Dst(output, n));
return StatusCodes.QTL_OK;
}
catch { return StatusCodes.QTL_ERR_INTERNAL; }