mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 10:38:05 +00:00
fix(frama): rewire Python export to use H/L arrays instead of single source
This commit is contained in:
@@ -166,7 +166,7 @@ HAS_RWMA = _bind("qtl_rwma", [_dp, _dp, _dp, _dp, _ci, _ci])
|
|||||||
# Trends — IIR
|
# Trends — IIR
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
HAS_ADXVMA = _bind("qtl_adxvma", [_dp, _dp, _dp, _dp, _dp, _ci, _ci, _dp])
|
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_HOLT = _bind("qtl_holt", [_dp, _dp, _ci, _ci, _cd])
|
||||||
HAS_HTIT = _bind("qtl_htit", [_dp, _dp, _ci])
|
HAS_HTIT = _bind("qtl_htit", [_dp, _dp, _ci])
|
||||||
HAS_HWMA = _bind("qtl_hwma", [_dp, _dp, _ci, _ci])
|
HAS_HWMA = _bind("qtl_hwma", [_dp, _dp, _ci, _ci])
|
||||||
|
|||||||
@@ -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)
|
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."""
|
"""Fractal Adaptive Moving Average."""
|
||||||
period = int(kwargs.get("length", period))
|
period = int(kwargs.get("length", period))
|
||||||
offset = int(offset)
|
offset = int(offset)
|
||||||
src, idx = _arr(close)
|
h, idx = _arr(high); l, _ = _arr(low)
|
||||||
n = len(src)
|
n = len(h)
|
||||||
output = _out(n)
|
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)
|
return _wrap(output, idx, f"FRAMA_{period}", "trends_iir", offset)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -575,13 +575,13 @@ public static unsafe partial class Exports
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UnmanagedCallersOnly(EntryPoint = "qtl_frama")]
|
[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;
|
if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH;
|
||||||
try
|
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;
|
return StatusCodes.QTL_OK;
|
||||||
}
|
}
|
||||||
catch { return StatusCodes.QTL_ERR_INTERNAL; }
|
catch { return StatusCodes.QTL_ERR_INTERNAL; }
|
||||||
|
|||||||
Reference in New Issue
Block a user