// #nullable enable using System; using System.Runtime.InteropServices; using QuanTAlib; namespace QuanTAlib.Python; [System.Diagnostics.CodeAnalysis.SuppressMessage( "Security Hotspot", "S6640", Justification = "Generated NativeAOT export helpers bridge unmanaged caller-owned buffers into managed series objects. The unsafe context is required by the ABI and remains constrained to pointer-to-span copies over validated inputs.")] public static unsafe partial class Exports { private static TSeries BuildSeries(double* src, int n) { var t = new long[n]; var v = new double[n]; new ReadOnlySpan(src, n).CopyTo(v); for (int i = 0; i < n; i++) t[i] = i; return new TSeries(t, v); } private static TBarSeries BuildBars(double* open, double* high, double* low, double* close, double* volume, int n) { var t = new long[n]; var o = new double[n]; var h = new double[n]; var l = new double[n]; var c = new double[n]; var v = new double[n]; new ReadOnlySpan(open, n).CopyTo(o); new ReadOnlySpan(high, n).CopyTo(h); new ReadOnlySpan(low, n).CopyTo(l); new ReadOnlySpan(close, n).CopyTo(c); new ReadOnlySpan(volume, n).CopyTo(v); for (int i = 0; i < n; i++) t[i] = i; var bars = new TBarSeries(n); bars.AddRange(t, o, h, l, c, v); return bars; } [UnmanagedCallersOnly(EntryPoint = "qtl_abber")] public static int QtlAbber(double* source, double* middle, double* upper, double* lower, int n, int period, double multiplier) { if (source == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Aberr.Batch(Src(source, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ac")] public static int QtlAc(double* high, double* low, double* destination, int n, int fastPeriod, int slowPeriod, int acPeriod) { if (high == null || low == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ac.Batch(Src(high, n), Src(low, n), Dst(destination, n), fastPeriod, slowPeriod, acPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_accbands")] public static int QtlAccBands(double* high, double* low, double* close, double* middle, double* upper, double* lower, int n, int period, double factor) { if (high == null || low == null || close == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { AccBands.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, factor); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_accel")] public static int QtlAccel(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Accel.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_acf")] public static int QtlAcf(double* source, double* output, int n, int period, int lag) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Acf.Batch(Src(source, n), Dst(output, n), period, lag); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_adf")] public static int QtlAdf(double* source, double* output, int n, int period, int maxLag, int regression) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Adf.Batch(Src(source, n), Dst(output, n), period, maxLag, (Adf.AdfRegression)regression); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ad")] public static int QtlAd(double* high, double* low, double* close, double* volume, double* output, int n) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ad.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_adosc")] public static int QtlAdosc(double* high, double* low, double* close, double* volume, double* output, int n, int fastPeriod, int slowPeriod) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Adosc.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n), fastPeriod, slowPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_adr")] public static int QtlAdr(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int method, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Adr.Batch(sourceBars, period, (AdrMethod)method); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_adx")] public static int QtlAdx(double* high, double* low, double* close, int period, int n, double* destination) { if (high == null || low == null || close == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Adx.Batch(Src(high, n), Src(low, n), Src(close, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_adxr")] public static int QtlAdxr(double* high, double* low, double* close, int period, int n, double* destination) { if (high == null || low == null || close == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Adxr.Batch(Src(high, n), Src(low, n), Src(close, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_adxvma")] public static int QtlAdxvma(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Adxvma.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_alligator")] public static int QtlAlligator(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int jawPeriod, int jawOffset, int teethPeriod, int teethOffset, int lipsPeriod, int lipsOffset, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Alligator.Batch(sourceBars, jawPeriod, jawOffset, teethPeriod, teethOffset, lipsPeriod, lipsOffset); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_amat")] public static int QtlAmat(double* source, double* trend, double* strength, int n, int fastPeriod, int slowPeriod) { if (source == null || trend == null || strength == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Amat.Batch(Src(source, n), Dst(trend, n), Dst(strength, n), fastPeriod, slowPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ao")] public static int QtlAo(double* high, double* low, double* destination, int n, int fastPeriod, int slowPeriod) { if (high == null || low == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ao.Batch(Src(high, n), Src(low, n), Dst(destination, n), fastPeriod, slowPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_apz")] public static int QtlApz(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, double multiplier, int n, double* dstMiddle, double* dstUpper, double* dstLower) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dstMiddle == null || dstUpper == null || dstLower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Apz.Batch(sourceBars, period, multiplier); var valuesMiddle = result.Middle.Values; if (valuesMiddle.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanMiddle = Dst(dstMiddle, n); outSpanMiddle.Fill(double.NaN); valuesMiddle.CopyTo(outSpanMiddle); var valuesUpper = result.Upper.Values; if (valuesUpper.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanUpper = Dst(dstUpper, n); outSpanUpper.Fill(double.NaN); valuesUpper.CopyTo(outSpanUpper); var valuesLower = result.Lower.Values; if (valuesLower.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanLower = Dst(dstLower, n); outSpanLower.Fill(double.NaN); valuesLower.CopyTo(outSpanLower); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_aroon")] public static int QtlAroon(double* high, double* low, int period, int n, double* destination) { if (high == null || low == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Aroon.Batch(Src(high, n), Src(low, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_aroonosc")] public static int QtlAroonOsc(double* high, double* low, int period, int n, double* destination) { if (high == null || low == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { AroonOsc.Batch(Src(high, n), Src(low, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_atrstop")] public static int QtlAtrstop(double* high, double* low, double* close, double* output, int n, int period, double multiplier) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; if (period <= 0) return StatusCodes.QTL_ERR_INVALID_PARAM; try { Atrstop.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_atr")] public static int QtlAtr(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Atr.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_atrn")] public static int QtlAtrn(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Atrn.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_bbs")] public static int QtlBbs(double* high, double* low, double* close, double* output, int n, int bbPeriod, double bbMult) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Bbs.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), bbPeriod, bbMult); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_bop")] public static int QtlBop(double* open, double* high, double* low, double* close, double* destination, int n) { if (open == null || high == null || low == null || close == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Bop.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_bwmfi")] public static int QtlBwMfi(double* high, double* low, double* volume, double* mfiOutput, double* zoneOutput, int n) { if (high == null || low == null || volume == null || mfiOutput == null || zoneOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var hi = Src(high, n); var lo = Src(low, n); var vol = Src(volume, n); var mfiTmp = new double[n]; var zoneTmp = new int[n]; BwMfi.Batch(hi, lo, vol, mfiTmp.AsSpan(), zoneTmp.AsSpan()); mfiTmp.AsSpan().CopyTo(Dst(mfiOutput, n)); var zoneDst = Dst(zoneOutput, n); for (int i = 0; i < n; i++) { zoneDst[i] = zoneTmp[i]; } return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_dstoch")] public static int QtlDstoch(double* high, double* low, double* close, double* output, int n, int period) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; if (period <= 0) return StatusCodes.QTL_ERR_INVALID_PARAM; try { Dstoch.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_cci")] public static int QtlCci(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Cci.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_chandelier")] public static int QtlChandelier(double* open, double* high, double* low, double* close, double* output, int n, int period, double multiplier) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Chandelier.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_chop")] public static int QtlChop(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Chop.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ckstop")] public static int QtlCkstop(double* open, double* high, double* low, double* close, double* output, int n, int atrPeriod, double multiplier, int stopPeriod) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ckstop.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), atrPeriod, multiplier, stopPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_coppock")] public static int QtlCoppock(double* source, double* output, int n, int longRoc, int shortRoc, int wmaPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Coppock.Batch(Src(source, n), Dst(output, n), longRoc, shortRoc, wmaPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_dc")] public static int QtlDc(double* high, double* low, double* middle, double* upper, double* lower, int n, int period) { if (high == null || low == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Dc.Batch(Src(high, n), Src(low, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_decaychannel")] public static int QtlDecaychannel(double* high, double* low, double* middle, double* upper, double* lower, int n, int period) { if (high == null || low == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Decaychannel.Batch(Src(high, n), Src(low, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_dmh")] public static int QtlDmh(double* high, double* low, int period, int n, double* destination) { if (high == null || low == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Dmh.Batch(Src(high, n), Src(low, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_dmx")] public static int QtlDmx(double* high, double* low, double* close, int period, int n, double* destination) { if (high == null || low == null || close == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Dmx.Batch(Src(high, n), Src(low, n), Src(close, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_dx")] public static int QtlDx(double* high, double* low, double* close, int period, int n, double* destination) { if (high == null || low == null || close == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Dx.Batch(Src(high, n), Src(low, n), Src(close, n), period, Dst(destination, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_eri")] public static int QtlEri(double* source, int period, int n, double* dst) { if (source == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceSeries = BuildSeries(source, n); var result = Eri.Batch(sourceSeries, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_fcb")] public static int QtlFcb(double* high, double* low, double* middle, double* upper, double* lower, int n, int period) { if (high == null || low == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Fcb.Batch(Src(high, n), Src(low, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_fdist")] public static int QtlFdist(double* source, double* output, int n, int d1, int d2, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Fdist.Batch(Src(source, n), Dst(output, n), d1, d2, period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_fft")] public static int QtlFft(double* src, double* output, int n, int windowSize, int minPeriod, int maxPeriod) { if (src == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Fft.Batch(Src(src, n), Dst(output, n), windowSize, minPeriod, maxPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_fi")] public static int QtlFi(double* source, int period, int n, double* dst) { if (source == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceSeries = BuildSeries(source, n); var result = Fi.Batch(sourceSeries, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_fractals")] public static int QtlFractals(double* high, double* low, double* upOutput, double* downOutput, int n) { if (high == null || low == null || upOutput == null || downOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Fractals.Batch(Src(high, n), Src(low, n), Dst(upOutput, n), Dst(downOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_frama")] public static int QtlFrama(double* high, double* low, double* output, int n, int period) { 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(high, n), Src(low, n), period, Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_fwma")] public static int QtlFwma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Fwma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_gammadist")] public static int QtlGammadist(double* source, double* output, int n, double alpha, double beta, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Gammadist.Batch(Src(source, n), Dst(output, n), alpha, beta, period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_gator")] public static int QtlGator(double* source, double* output, int n, int jawPeriod, int jawShift, int teethPeriod, int teethShift, int lipsPeriod, int lipsShift) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Gator.Batch(Src(source, n), Dst(output, n), jawPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_gauss")] public static int QtlGauss(double* source, double* output, int n, double sigma) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Gauss.Batch(Src(source, n), Dst(output, n), sigma); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_geomean")] public static int QtlGeomean(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Geomean.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ghla")] public static int QtlGhla(double* high, double* low, double* close, double* output, int n, int period) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ghla.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_gkv")] public static int QtlGkv(double* open, double* high, double* low, double* close, double* output, int n, int period, int annualize, int annualPeriods) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Gkv.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period, annualize != 0, annualPeriods); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_granger")] public static int QtlGranger(double* seriesY, double* seriesX, double* output, int n, int period) { if (seriesY == null || seriesX == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Granger.Batch(Src(seriesY, n), Src(seriesX, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_gwma")] public static int QtlGwma(double* source, double* output, int n, int period, double sigma) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Gwma.Batch(Src(source, n), Dst(output, n), period, sigma); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ha")] public static int QtlHa(double* open, double* high, double* low, double* close, double* haOpenOut, double* haHighOut, double* haLowOut, double* haCloseOut, int n) { if (open == null || high == null || low == null || close == null || haOpenOut == null || haHighOut == null || haLowOut == null || haCloseOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ha.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(haOpenOut, n), Dst(haHighOut, n), Dst(haLowOut, n), Dst(haCloseOut, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hamma")] public static int QtlHamma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hamma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hann")] public static int QtlHann(double* source, double* output, int n, int length) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hann.Batch(Src(source, n), Dst(output, n), length); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_harmean")] public static int QtlHarmean(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Harmean.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hend")] public static int QtlHend(double* source, double* output, int n, int period, double nanValue) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hend.Batch(Src(source, n), Dst(output, n), period, nanValue); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_highest")] public static int QtlHighest(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Highest.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hlv")] public static int QtlHlv(double* high, double* low, double* output, int n, int period, int annualize, int annualPeriods) { if (high == null || low == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hlv.Batch(Src(high, n), Src(low, n), Dst(output, n), period, annualize != 0, annualPeriods); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_holt")] public static int QtlHolt(double* source, double* output, int n, int period, double gamma) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Holt.Batch(Src(source, n), Dst(output, n), period, gamma); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_homod")] public static int QtlHomod(double* source, double* output, int n, double minPeriod, double maxPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Homod.Batch(Src(source, n), Dst(output, n), minPeriod, maxPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hp")] public static int QtlHp(double* source, double* output, int n, double lambda) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hp.Batch(Src(source, n), Dst(output, n), lambda); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hpf")] public static int QtlHpf(double* source, double* output, int n, int length) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hpf.Batch(Src(source, n), Dst(output, n), length); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_htdcperiod")] public static int QtlHtDcperiod(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { HtDcperiod.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_htdcphase")] public static int QtlHtDcphase(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { HtDcphase.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_htphasor")] public static int QtlHtPhasor(double* source, double* inPhase, double* quadrature, int n) { if (source == null || inPhase == null || quadrature == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { HtPhasor.Batch(Src(source, n), Dst(inPhase, n), Dst(quadrature, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_htsine")] public static int QtlHtSine(double* source, double* sine, double* leadSine, int n) { if (source == null || sine == null || leadSine == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { HtSine.Batch(Src(source, n), Dst(sine, n), Dst(leadSine, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_httrendmode")] public static int QtlHtTrendmode(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { HtTrendmode.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_httrendline")] public static int QtlHtTrendline(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { HtTrendline.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_huber")] public static int QtlHuber(double* actual, double* predicted, double* output, int n, int period, double delta) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Huber.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period, delta); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hurst")] public static int QtlHurst(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hurst.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hv")] public static int QtlHv(double* prices, double* output, int n, int period, int annualize, int annualPeriods) { if (prices == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hv.Batch(Src(prices, n), Dst(output, n), period, annualize != 0, annualPeriods); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_hwma")] public static int QtlHwma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Hwma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ichimoku")] public static int QtlIchimoku(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int tenkanPeriod, int kijunPeriod, int senkouBPeriod, int displacement, int n, double* dstTenkan, double* dstKijun, double* dstSenkouA, double* dstSenkouB, double* dstChikou) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dstTenkan == null || dstKijun == null || dstSenkouA == null || dstSenkouB == null || dstChikou == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Ichimoku.Batch(sourceBars, tenkanPeriod, kijunPeriod, senkouBPeriod, displacement); var valuesTenkan = result.Tenkan.Values; if (valuesTenkan.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanTenkan = Dst(dstTenkan, n); outSpanTenkan.Fill(double.NaN); valuesTenkan.CopyTo(outSpanTenkan); var valuesKijun = result.Kijun.Values; if (valuesKijun.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanKijun = Dst(dstKijun, n); outSpanKijun.Fill(double.NaN); valuesKijun.CopyTo(outSpanKijun); var valuesSenkouA = result.SenkouA.Values; if (valuesSenkouA.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanSenkouA = Dst(dstSenkouA, n); outSpanSenkouA.Fill(double.NaN); valuesSenkouA.CopyTo(outSpanSenkouA); var valuesSenkouB = result.SenkouB.Values; if (valuesSenkouB.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanSenkouB = Dst(dstSenkouB, n); outSpanSenkouB.Fill(double.NaN); valuesSenkouB.CopyTo(outSpanSenkouB); var valuesChikou = result.Chikou.Values; if (valuesChikou.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpanChikou = Dst(dstChikou, n); outSpanChikou.Fill(double.NaN); valuesChikou.CopyTo(outSpanChikou); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ifft")] public static int QtlIfft(double* src, double* output, int n, int windowSize, int numHarmonics) { if (src == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ifft.Batch(Src(src, n), Dst(output, n), windowSize, numHarmonics); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_iii")] public static int QtlIii(double* high, double* low, double* close, double* volume, double* output, int n, int period, int cumulative) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Iii.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n), period, cumulative != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ilrs")] public static int QtlIlrs(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ilrs.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_imi")] public static int QtlImi(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Imi.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_impulse")] public static int QtlImpulse(double* source, int emaPeriod, int macdFast, int macdSlow, int macdSignal, int n, double* dst) { if (source == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceSeries = BuildSeries(source, n); var result = Impulse.Batch(sourceSeries, emaPeriod, macdFast, macdSlow, macdSignal); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_iqr")] public static int QtlIqr(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Iqr.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_jb")] public static int QtlJb(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Jb.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_jbands")] public static int QtlJbands(double* source, double* middle, double* upper, double* lower, int n, int period, int phase) { if (source == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Jbands.Batch(Src(source, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, phase); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_jerk")] public static int QtlJerk(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Jerk.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_jma")] public static int QtlJma(double* source, double* output, int n, int period, int phase) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Jma.Batch(Src(source, n), Dst(output, n), period, phase); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_jvolty")] public static int QtlJvolty(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Jvolty.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_jvoltyn")] public static int QtlJvoltyn(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Jvoltyn.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kaiser")] public static int QtlKaiser(double* source, double* output, int n, int period, double beta, double nanValue) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kaiser.Batch(Src(source, n), Dst(output, n), period, beta, nanValue); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kalman")] public static int QtlKalman(double* source, double* output, int n, double q, double r) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kalman.Batch(Src(source, n), Dst(output, n), q, r); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kama")] public static int QtlKama(double* source, double* output, int n, int period, int fastPeriod, int slowPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kama.Batch(Src(source, n), Dst(output, n), period, fastPeriod, slowPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kc")] public static int QtlKc(double* high, double* low, double* close, double* middle, double* upper, double* lower, int n, int period, double multiplier) { if (high == null || low == null || close == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kc.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kdj")] public static int QtlKdj(double* high, double* low, double* close, double* kOut, double* dOut, double* jOut, int n, int length, int signal) { if (high == null || low == null || close == null || kOut == null || dOut == null || jOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kdj.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(kOut, n), Dst(dOut, n), Dst(jOut, n), length, signal); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kendall")] public static int QtlKendall(double* seriesX, double* seriesY, double* output, int n, int period) { if (seriesX == null || seriesY == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kendall.Batch(Src(seriesX, n), Src(seriesY, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kst")] public static int QtlKst(double* source, double* kstOut, double* sigOut, int n, int r1, int r2, int r3, int r4, int s1, int s2, int s3, int s4, int sigPeriod) { if (source == null || kstOut == null || sigOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kst.Batch(Src(source, n), Dst(kstOut, n), Dst(sigOut, n), r1, r2, r3, r4, s1, s2, s3, s4, sigPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kurtosis")] public static int QtlKurtosis(double* source, double* output, int n, int period, int isPopulation) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kurtosis.Batch(Src(source, n), Dst(output, n), period, isPopulation != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_kvo")] public static int QtlKvo(double* high, double* low, double* close, double* volume, double* output, double* signal, int n, int fastPeriod, int slowPeriod, int signalPeriod) { if (high == null || low == null || close == null || volume == null || output == null || signal == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Kvo.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n), Dst(signal, n), fastPeriod, slowPeriod, signalPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_laguerre")] public static int QtlLaguerre(double* source, double* output, int n, double gamma) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Laguerre.Batch(Src(source, n), Dst(output, n), gamma); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_lanczos")] public static int QtlLanczos(double* source, double* output, int n, int period, double nanValue) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Lanczos.Batch(Src(source, n), Dst(output, n), period, nanValue); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_linreg")] public static int QtlLinReg(double* source, double* output, int n, int period, int offset, double initialLastValid) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { LinReg.Batch(Src(source, n), Dst(output, n), period, offset, initialLastValid); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_lineartrans")] public static int QtlLineartrans(double* source, double* output, int n, double slope, double intercept) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Lineartrans.Batch(Src(source, n), Dst(output, n), slope, intercept); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_lms")] public static int QtlLms(double* source, double* output, int n, int order, double mu) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Lms.Batch(Src(source, n), Dst(output, n), order, mu); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_loess")] public static int QtlLoess(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Loess.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_logcosh")] public static int QtlLogCosh(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { LogCosh.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_lognormdist")] public static int QtlLognormdist(double* source, double* output, int n, double mu, double sigma, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Lognormdist.Batch(Src(source, n), Dst(output, n), mu, sigma, period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_logtrans")] public static int QtlLogtrans(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Logtrans.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_lowest")] public static int QtlLowest(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Lowest.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ltma")] public static int QtlLtma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ltma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_lunar")] public static int QtlLunar(double* source, int n, double* dst) { if (source == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceSeries = BuildSeries(source, n); var result = Lunar.Batch(sourceSeries); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_maape")] public static int QtlMaape(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Maape.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_macd")] public static int QtlMacd(double* source, double* destination, int n, int fastPeriod, int slowPeriod) { if (source == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Macd.Batch(Src(source, n), Dst(destination, n), fastPeriod, slowPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_maenv")] public static int QtlMaenv(double* source, double* middle, double* upper, double* lower, int n, int period, double percentage, int maType) { if (source == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Maenv.Batch(Src(source, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, percentage, (MaenvType)maType); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mama")] public static int QtlMama(double* source, double* output, double fastLimit, int n, double slowLimit, double* famaOutput) { if (source == null || output == null || famaOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mama.Batch(Src(source, n), Dst(output, n), fastLimit, slowLimit, Dst(famaOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mapd")] public static int QtlMapd(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mapd.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_marketfi")] public static int QtlMarketfi(double* high, double* low, double* volume, double* output, int n) { if (high == null || low == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Marketfi.Batch(Src(high, n), Src(low, n), Src(volume, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mase")] public static int QtlMase(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mase.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_massi")] public static int QtlMassi(double* source, double* output, int n, int emaLength, int sumLength) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Massi.Batch(Src(source, n), Dst(output, n), emaLength, sumLength); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mavp")] public static int QtlMavp(double* source, double* periods, double* output, int n, int minPeriod, int maxPeriod) { if (source == null || periods == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mavp.Batch(Src(source, n), Src(periods, n), Dst(output, n), minPeriod, maxPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_maxindex")] public static int QtlMaxindex(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Maxindex.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mcnma")] public static int QtlMcnma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mcnma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mdae")] public static int QtlMdae(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mdae.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mdape")] public static int QtlMdape(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mdape.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_me")] public static int QtlMe(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Me.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_meandev")] public static int QtlMeanDev(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { MeanDev.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_median")] public static int QtlMedian(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Median.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mgdi")] public static int QtlMgdi(double* source, double* output, int n, int period, double k) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mgdi.Batch(Src(source, n), Dst(output, n), period, k); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_midpoint")] public static int QtlMidpoint(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Midpoint.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_midprice")] public static int QtlMidprice(double* high, double* low, double* output, int n, int period) { if (high == null || low == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Midprice.Batch(Src(high, n), Src(low, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_minindex")] public static int QtlMinindex(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Minindex.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_minusdi")] public static int QtlMinusDi(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = MinusDi.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_minusdm")] public static int QtlMinusDm(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = MinusDm.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mma")] public static int QtlMma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mmchannel")] public static int QtlMmchannel(double* high, double* low, double* upper, double* lower, int n, int period) { if (high == null || low == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mmchannel.Batch(Src(high, n), Src(low, n), Dst(upper, n), Dst(lower, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mode")] public static int QtlMode(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mode.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_modf")] public static int QtlModf(double* source, double* output, int n, int period, double beta, int feedback, double fbWeight) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Modf.Batch(Src(source, n), Dst(output, n), period, beta, feedback != 0, fbWeight); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mpe")] public static int QtlMpe(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mpe.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mrae")] public static int QtlMrae(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mrae.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_msle")] public static int QtlMsle(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Msle.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_mstoch")] public static int QtlMstoch(double* src, double* output, int n, int stochLength, int hpLength, int ssLength) { if (src == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Mstoch.Batch(Src(src, n), Dst(output, n), stochLength, hpLength, ssLength); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_natr")] public static int QtlNatr(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Natr.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_nlma")] public static int QtlNlma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Nlma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_nma")] public static int QtlNma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Nma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_normalize")] public static int QtlNormalize(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Normalize.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_normdist")] public static int QtlNormdist(double* source, double* output, int n, double mu, double sigma, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Normdist.Batch(Src(source, n), Dst(output, n), mu, sigma, period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_notch")] public static int QtlNotch(double* source, double* output, int n, int period, double q) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Notch.Batch(Src(source, n), Dst(output, n), period, q); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_nw")] public static int QtlNw(double* source, double* output, int n, int period, double bandwidth) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Nw.Batch(Src(source, n), Dst(output, n), period, bandwidth); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_nyqma")] public static int QtlNyqma(double* source, double* output, int n, int period, int nyquistPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Nyqma.Batch(Src(source, n), Dst(output, n), period, nyquistPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_oneeuro")] public static int QtlOneEuro(double* source, double* output, int n, double minCutoff, double beta, double dCutoff) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { OneEuro.Batch(Src(source, n), Dst(output, n), minCutoff, beta, dCutoff); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pacf")] public static int QtlPacf(double* source, double* output, int n, int period, int lag) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pacf.Batch(Src(source, n), Dst(output, n), period, lag); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pc")] public static int QtlPc(double* high, double* low, double* middle, double* upper, double* lower, int n, int period) { if (high == null || low == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pc.Batch(Src(high, n), Src(low, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_percentile")] public static int QtlPercentile(double* source, double* output, int n, int period, double percent) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Percentile.Batch(Src(source, n), Dst(output, n), period, percent); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pfe")] public static int QtlPfe(double* source, double* output, int n, int period, int smoothPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pfe.Batch(Src(source, n), Dst(output, n), period, smoothPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pgo")] public static int QtlPgo(double* high, double* low, double* close, double* destination, int n, int period) { if (high == null || low == null || close == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pgo.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(destination, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pivot")] public static int QtlPivot(double* high, double* low, double* close, double* ppOutput, int n) { if (high == null || low == null || close == null || ppOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pivot.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(ppOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pivotcam")] public static int QtlPivotcam(double* high, double* low, double* close, double* ppOutput, int n) { if (high == null || low == null || close == null || ppOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pivotcam.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(ppOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pivotdem")] public static int QtlPivotdem(double* open, double* high, double* low, double* close, double* ppOutput, int n) { if (open == null || high == null || low == null || close == null || ppOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pivotdem.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(ppOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pivotext")] public static int QtlPivotext(double* high, double* low, double* close, double* ppOutput, int n) { if (high == null || low == null || close == null || ppOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pivotext.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(ppOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pivotfib")] public static int QtlPivotfib(double* high, double* low, double* close, double* ppOutput, int n) { if (high == null || low == null || close == null || ppOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pivotfib.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(ppOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pivotwood")] public static int QtlPivotwood(double* high, double* low, double* close, double* ppOutput, int n) { if (high == null || low == null || close == null || ppOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pivotwood.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(ppOutput, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_plusdi")] public static int QtlPlusDi(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = PlusDi.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_plusdm")] public static int QtlPlusDm(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = PlusDm.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pma")] public static int QtlPma(double* source, double* pmaOutput, double* triggerOutput, int n, int period) { if (source == null || pmaOutput == null || triggerOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pma.Batch(Src(source, n), Dst(pmaOutput, n), Dst(triggerOutput, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pmo")] public static int QtlPmo(double* source, double* output, int n, int timePeriods, int smoothPeriods, int signalPeriods) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pmo.Batch(Src(source, n), Dst(output, n), timePeriods, smoothPeriods, signalPeriods); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_poissondist")] public static int QtlPoissondist(double* source, double* output, int n, double lambda, int period, int threshold) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Poissondist.Batch(Src(source, n), Dst(output, n), lambda, period, threshold); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_polyfit")] public static int QtlPolyfit(double* source, double* output, int n, int period, int degree, double initialLastValid) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Polyfit.Batch(Src(source, n), Dst(output, n), period, degree, initialLastValid); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ppo")] public static int QtlPpo(double* source, double* destination, int n, int fastPeriod, int slowPeriod) { if (source == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ppo.Batch(Src(source, n), Dst(destination, n), fastPeriod, slowPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rs")] public static int QtlRs(double* baseSeries, double* compSeries, double* output, int n, int smoothPeriod) { if (baseSeries == null || compSeries == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rs.Batch(Src(baseSeries, n), Src(compSeries, n), Dst(output, n), smoothPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sar")] public static int QtlSar(double* open, double* high, double* low, double* close, double* output, int n, double afStart, double afIncrement, double afMax) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sar.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), afStart, afIncrement, afMax); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pseudohuber")] public static int QtlPseudoHuber(double* actual, double* predicted, double* output, int n, int period, double delta) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { PseudoHuber.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period, delta); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_pwma")] public static int QtlPwma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Pwma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_qema")] public static int QtlQema(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Qema.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_qqe")] public static int QtlQqe(double* source, double* output, int n, int rsiPeriod, int smoothFactor, double qqeFactor) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Qqe.Batch(Src(source, n), Dst(output, n), rsiPeriod, smoothFactor, qqeFactor); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_qrma")] public static int QtlQrma(double* source, double* output, int n, int period, double initialLastValid) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Qrma.Batch(Src(source, n), Dst(output, n), period, initialLastValid); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_qstick")] public static int QtlQstick(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int useEma, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Qstick.Batch(sourceBars, period, useEma != 0); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_quantile")] public static int QtlQuantile(double* source, double* output, int n, int period, double quantileLevel) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Quantile.Batch(Src(source, n), Dst(output, n), period, quantileLevel); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_quantileloss")] public static int QtlQuantileLoss(double* actual, double* predicted, double* output, int n, int period, double quantile) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { QuantileLoss.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period, quantile); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rae")] public static int QtlRae(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rae.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ravi")] public static int QtlRavi(double* source, double* output, int n, int shortPeriod, int longPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ravi.Batch(Src(source, n), Dst(output, n), shortPeriod, longPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_regchannel")] public static int QtlRegchannel(double* source, double* middle, double* upper, double* lower, int n, int period, double multiplier) { if (source == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Regchannel.Batch(Src(source, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_relu")] public static int QtlRelu(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Relu.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rema")] public static int QtlRema(double* source, double* output, int n, int period, double lambda) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rema.Batch(Src(source, n), Dst(output, n), period, lambda); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_reverseema")] public static int QtlReverseEma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { ReverseEma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rgma")] public static int QtlRgma(double* source, double* output, int n, int period, int passes) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rgma.Batch(Src(source, n), Dst(output, n), period, passes); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rls")] public static int QtlRls(double* source, double* output, int n, int order, double lambda) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rls.Batch(Src(source, n), Dst(output, n), order, lambda); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rma")] public static int QtlRma(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rma.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rmed")] public static int QtlRmed(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rmed.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rmsle")] public static int QtlRmsle(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rmsle.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rocp")] public static int QtlRocp(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rocp.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rocr")] public static int QtlRocr(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rocr.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_roofing")] public static int QtlRoofing(double* source, double* output, int n, int hpLength, int ssLength) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Roofing.Batch(Src(source, n), Dst(output, n), hpLength, ssLength); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rse")] public static int QtlRse(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rse.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rsquared")] public static int QtlRsquared(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rsquared.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rsv")] public static int QtlRsv(double* open, double* high, double* low, double* close, double* output, int n, int period, int annualize, int annualPeriods) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rsv.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period, annualize != 0, annualPeriods); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rv")] public static int QtlRv(double* prices, double* output, int n, int period, int smoothingPeriod, int annualize, int annualPeriods) { if (prices == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rv.Batch(Src(prices, n), Dst(output, n), period, smoothingPeriod, annualize != 0, annualPeriods); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rvgi")] public static int QtlRvgi(double* open, double* high, double* low, double* close, double* rvgiOutput, double* signalOutput, int n, int period) { if (open == null || high == null || low == null || close == null || rvgiOutput == null || signalOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rvgi.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(rvgiOutput, n), Dst(signalOutput, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rvi")] public static int QtlRvi(double* prices, double* output, int n, int stdevLength, int rmaLength) { if (prices == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rvi.Batch(Src(prices, n), Dst(output, n), stdevLength, rmaLength); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_rwma")] public static int QtlRwma(double* close, double* high, double* low, double* output, int n, int period) { if (close == null || high == null || low == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Rwma.Batch(Src(close, n), Src(high, n), Src(low, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sam")] public static int QtlSam(double* source, double* output, int n, double alpha, int cutoff) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sam.Batch(Src(source, n), Dst(output, n), alpha, cutoff); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sarext")] public static int QtlSarext(double* open, double* high, double* low, double* close, double* output, int n, double startValue, double offsetOnReverse, double afInitLong, double afLong, double afMaxLong, double afInitShort, double afShort, double afMaxShort) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sarext.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), n, startValue, offsetOnReverse, afInitLong, afLong, afMaxLong, afInitShort, afShort, afMaxShort); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sdchannel")] public static int QtlSdchannel(double* source, double* middle, double* upper, double* lower, int n, int period, double multiplier) { if (source == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sdchannel.Batch(Src(source, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sgf")] public static int QtlSgf(double* source, double* output, int n, int period, int polyOrder) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sgf.Batch(Src(source, n), Dst(output, n), period, polyOrder); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sigmoid")] public static int QtlSigmoid(double* source, double* output, int n, double k, double x0) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sigmoid.Batch(Src(source, n), Dst(output, n), k, x0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_skew")] public static int QtlSkew(double* source, double* output, int n, int period, int isPopulation) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Skew.Batch(Src(source, n), Dst(output, n), period, isPopulation != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_slope")] public static int QtlSlope(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Slope.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_smape")] public static int QtlSmape(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Smape.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_smi")] public static int QtlSmi(double* high, double* low, double* close, double* kOut, double* dOut, int n, int kPeriod, int kSmooth, int dSmooth, int blau) { if (high == null || low == null || close == null || kOut == null || dOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Smi.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(kOut, n), Dst(dOut, n), kPeriod, kSmooth, dSmooth, blau != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_solar")] public static int QtlSolar(double* source, int n, double* dst) { if (source == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceSeries = BuildSeries(source, n); var result = Solar.Batch(sourceSeries); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_spbf")] public static int QtlSpbf(double* source, double* output, int n, int shortPeriod, int longPeriod, int rmsPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Spbf.Batch(Src(source, n), Dst(output, n), shortPeriod, longPeriod, rmsPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_spearman")] public static int QtlSpearman(double* seriesX, double* seriesY, double* output, int n, int period) { if (seriesX == null || seriesY == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Spearman.Batch(Src(seriesX, n), Src(seriesY, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sqrttrans")] public static int QtlSqrttrans(double* source, double* output, int n) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sqrttrans.Batch(Src(source, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_squeeze")] public static int QtlSqueeze(double* high, double* low, double* close, double* momOut, double* sqOut, int n, int period, double bbMult, double kcMult) { if (high == null || low == null || close == null || momOut == null || sqOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Squeeze.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(momOut, n), Dst(sqOut, n), period, bbMult, kcMult); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_squeeze_pro")] public static int QtlSqueezePro(double* high, double* low, double* close, double* momOut, double* sqOut, int n, int period, double bbMult, double kcMultWide, double kcMultNormal, double kcMultNarrow, int momLength, int momSmooth, int useSma) { if (high == null || low == null || close == null || momOut == null || sqOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { SqueezePro.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(momOut, n), Dst(sqOut, n), period, bbMult, kcMultWide, kcMultNormal, kcMultNarrow, momLength, momSmooth, useSma != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ssf2")] public static int QtlSsf2(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ssf2.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ssf3")] public static int QtlSsf3(double* source, double* destination, int n, int period, double initialLast) { if (source == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ssf3.Batch(Src(source, n), Dst(destination, n), period, initialLast); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ssfdsp")] public static int QtlSsfdsp(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ssfdsp.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_starchannel")] public static int QtlStarchannel(double* high, double* low, double* close, double* middle, double* upper, double* lower, int n, int period, double multiplier, int atrPeriod) { if (high == null || low == null || close == null || middle == null || upper == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Starchannel.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(middle, n), Dst(upper, n), Dst(lower, n), period, multiplier, atrPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_stbands")] public static int QtlStbands(double* high, double* low, double* close, double* upper, double* lower, double* trend, int n, int period, double multiplier) { if (high == null || low == null || close == null || upper == null || lower == null || trend == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Stbands.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(upper, n), Dst(lower, n), Dst(trend, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_stc")] public static int QtlStc(double* source, double* output, int n, int kPeriod, int dPeriod, int fastLength, int slowLength, int smoothing) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Stc.Batch(Src(source, n), Dst(output, n), kPeriod, dPeriod, fastLength, slowLength, (StcSmoothing)smoothing); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_stderr")] public static int QtlStderr(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Stderr.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_stoch")] public static int QtlStoch(double* high, double* low, double* close, double* kOut, double* dOut, int n, int kLength, int dPeriod) { if (high == null || low == null || close == null || kOut == null || dOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Stoch.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(kOut, n), Dst(dOut, n), kLength, dPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_stochf")] public static int QtlStochf(double* high, double* low, double* close, double* kOut, double* dOut, int n, int kLength, int dPeriod) { if (high == null || low == null || close == null || kOut == null || dOut == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Stochf.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(kOut, n), Dst(dOut, n), kLength, dPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_stochrsi")] public static int QtlStochrsi(double* source, double* output, int n, int rsiLength, int stochLength, int kSmooth, int dSmooth) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Stochrsi.Batch(Src(source, n), Dst(output, n), rsiLength, stochLength, kSmooth, dSmooth); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_sum")] public static int QtlSum(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Sum.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_super")] public static int QtlSuper(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, double multiplier, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Super.Batch(sourceBars, period, multiplier); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_swings")] public static int QtlSwings(double* high, double* low, double* highOutput, double* lowOutput, int n, int lookback) { if (high == null || low == null || highOutput == null || lowOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Swings.Batch(Src(high, n), Src(low, n), Dst(highOutput, n), Dst(lowOutput, n), lookback); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_t3")] public static int QtlT3(double* source, double* output, int n, int period, double vfactor) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { T3.Batch(Src(source, n), Dst(output, n), period, vfactor); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_tdist")] public static int QtlTdist(double* source, double* output, int n, int nu, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Tdist.Batch(Src(source, n), Dst(output, n), nu, period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_theil")] public static int QtlTheil(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Theil.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_theilu")] public static int QtlTheilU(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { TheilU.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_trama")] public static int QtlTrama(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Trama.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_trim")] public static int QtlTrim(double* source, double* output, int n, int period, double trimPct) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Trim.Batch(Src(source, n), Dst(output, n), period, trimPct); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ttmlrc")] public static int QtlTtmLrc(double* source, double* midline, double* upper1, double* lower1, double* upper2, double* lower2, int n, int period) { if (source == null || midline == null || upper1 == null || lower1 == null || upper2 == null || lower2 == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { TtmLrc.Batch(Src(source, n), Dst(midline, n), Dst(upper1, n), Dst(lower1, n), Dst(upper2, n), Dst(lower2, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ttmscalper")] public static int QtlTtmScalper(double* high, double* low, double* close, double* highOutput, double* lowOutput, int n, int useCloses) { if (high == null || low == null || close == null || highOutput == null || lowOutput == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { TtmScalper.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(highOutput, n), Dst(lowOutput, n), useCloses != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ttmsqueeze")] public static int QtlTtmSqueeze(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int bbPeriod, double bbMult, int kcPeriod, double kcMult, int momPeriod, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = TtmSqueeze.Batch(sourceBars, bbPeriod, bbMult, kcPeriod, kcMult, momPeriod); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ttmtrend")] public static int QtlTtmTrend(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int period, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = TtmTrend.Batch(sourceBars, period); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ttmwave")] public static int QtlTtmWave(double* source, int n, double* dst) { if (source == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceSeries = BuildSeries(source, n); var result = TtmWave.Batch(sourceSeries); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_tukeybiweight")] public static int QtlTukeyBiweight(double* actual, double* predicted, double* output, int n, int period, double c) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { TukeyBiweight.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period, c); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_twap")] public static int QtlTwap(double* price, double* output, int n, int period) { if (price == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Twap.Batch(Src(price, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ubands")] public static int QtlUbands(double* source, double* upper, double* middle, double* lower, int n, int period, double multiplier) { if (source == null || upper == null || middle == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ubands.Batch(Src(source, n), Dst(upper, n), Dst(middle, n), Dst(lower, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_uchannel")] public static int QtlUchannel(double* high, double* low, double* close, double* upper, double* middle, double* lower, int n, int strPeriod, int centerPeriod, double multiplier) { if (high == null || low == null || close == null || upper == null || middle == null || lower == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Uchannel.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(upper, n), Dst(middle, n), Dst(lower, n), strPeriod, centerPeriod, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ui")] public static int QtlUi(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ui.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ultosc")] public static int QtlUltosc(double* high, double* low, double* close, double* output, int n, int period1, int period2, int period3) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ultosc.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period1, period2, period3); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_usf")] public static int QtlUsf(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Usf.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_va")] public static int QtlVa(double* high, double* low, double* close, double* volume, double* output, int n) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Va.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vama")] public static int QtlVama(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int baseLength, int shortAtrPeriod, int longAtrPeriod, int minLength, int maxLength, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Vama.Batch(sourceBars, baseLength, shortAtrPeriod, longAtrPeriod, minLength, maxLength); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vel")] public static int QtlVel(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vel.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vhf")] public static int QtlVhf(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vhf.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vidya")] public static int QtlVidya(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vidya.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vo")] public static int QtlVo(double* volume, double* output, int n, int shortPeriod, int longPeriod) { if (volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vo.Batch(Src(volume, n), Dst(output, n), shortPeriod, longPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vortex")] public static int QtlVortex(double* high, double* low, double* close, int period, double* viPlus, int n, double* viMinus) { if (high == null || low == null || close == null || viPlus == null || viMinus == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vortex.Batch(Src(high, n), Src(low, n), Src(close, n), period, Dst(viPlus, n), Dst(viMinus, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_voss")] public static int QtlVoss(double* source, double* output, int n, int period, int predict, double bandwidth) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Voss.Batch(Src(source, n), Dst(output, n), period, predict, bandwidth); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vstop")] public static int QtlVstop(double* high, double* low, double* close, double* output, int n, int period, double multiplier) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; if (period <= 0) return StatusCodes.QTL_ERR_INVALID_PARAM; try { Vstop.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period, multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vov")] public static int QtlVov(double* source, double* output, int n, int volatilityPeriod, int vovPeriod) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vov.Batch(Src(source, n), Dst(output, n), volatilityPeriod, vovPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vr")] public static int QtlVr(double* high, double* low, double* close, double* output, int n, int period) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vr.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vroc")] public static int QtlVroc(double* volume, double* output, int n, int period, int usePercent) { if (volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vroc.Batch(Src(volume, n), Dst(output, n), period, usePercent != 0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vwad")] public static int QtlVwad(double* high, double* low, double* close, double* volume, double* output, int n, int period) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vwad.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vwap")] public static int QtlVwap(double* high, double* low, double* close, double* volume, double* output, int n, int period) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vwap.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vwapbands")] public static int QtlVwapbands(double* price, double* volume, double* upper1, double* lower1, double* upper2, double* lower2, double* vwap, double* stdDev, int n, double multiplier) { if (price == null || volume == null || upper1 == null || lower1 == null || upper2 == null || lower2 == null || vwap == null || stdDev == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vwapbands.Batch(Src(price, n), Src(volume, n), Dst(upper1, n), Dst(lower1, n), Dst(upper2, n), Dst(lower2, n), Dst(vwap, n), Dst(stdDev, n), multiplier); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_vwapsd")] public static int QtlVwapsd(double* price, double* volume, double* upper, double* lower, double* vwap, double* stdDev, int n, double numDevs) { if (price == null || volume == null || upper == null || lower == null || vwap == null || stdDev == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Vwapsd.Batch(Src(price, n), Src(volume, n), Dst(upper, n), Dst(lower, n), Dst(vwap, n), Dst(stdDev, n), numDevs); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wad")] public static int QtlWad(double* high, double* low, double* close, double* volume, double* output, int n) { if (high == null || low == null || close == null || volume == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wad.Batch(Src(high, n), Src(low, n), Src(close, n), Src(volume, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wavelet")] public static int QtlWavelet(double* source, double* output, int n, int levels, double threshMult) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wavelet.Batch(Src(source, n), Dst(output, n), levels, threshMult); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wavg")] public static int QtlWavg(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wavg.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wclprice")] public static int QtlWclprice(double* high, double* low, double* close, double* output, int n) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wclprice.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n)); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_weibulldist")] public static int QtlWeibulldist(double* source, double* output, int n, double k, double lambda, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Weibulldist.Batch(Src(source, n), Dst(output, n), k, lambda, period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wiener")] public static int QtlWiener(double* source, double* destination, int n, int period, int smoothPeriod) { if (source == null || destination == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wiener.Batch(Src(source, n), Dst(destination, n), period, smoothPeriod); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_willr")] public static int QtlWillr(double* high, double* low, double* close, double* output, int n, int period) { if (high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Willr.Batch(Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wins")] public static int QtlWins(double* source, double* output, int n, int period, double winPct) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wins.Batch(Src(source, n), Dst(output, n), period, winPct); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wmape")] public static int QtlWmape(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wmape.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_wrmse")] public static int QtlWrmse(double* actual, double* predicted, double* output, int n, int period) { if (actual == null || predicted == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Wrmse.Batch(Src(actual, n), Src(predicted, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_yzv")] public static int QtlYzv(double* open, double* high, double* low, double* close, double* output, int n, int period) { if (open == null || high == null || low == null || close == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Yzv.Batch(Src(open, n), Src(high, n), Src(low, n), Src(close, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_yzvama")] public static int QtlYzvama(double* sourceOpen, double* sourceHigh, double* sourceLow, double* sourceClose, double* sourceVolume, int yzvShortPeriod, int yzvLongPeriod, int percentileLookback, int minLength, int maxLength, int n, double* dst) { if (sourceOpen == null || sourceHigh == null || sourceLow == null || sourceClose == null || sourceVolume == null || dst == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { var sourceBars = BuildBars(sourceOpen, sourceHigh, sourceLow, sourceClose, sourceVolume, n); var result = Yzvama.Batch(sourceBars, yzvShortPeriod, yzvLongPeriod, percentileLookback, minLength, maxLength); var values = result.Values; if (values.Length > n) return StatusCodes.QTL_ERR_INVALID_LENGTH; var outSpan = Dst(dst, n); outSpan.Fill(double.NaN); values.CopyTo(outSpan); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_zldema")] public static int QtlZldema(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Zldema.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_zlema")] public static int QtlZlema(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Zlema.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_zltema")] public static int QtlZltema(double* source, double* output, int n, int period) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Zltema.Batch(Src(source, n), Dst(output, n), period); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } [UnmanagedCallersOnly(EntryPoint = "qtl_ztest")] public static int QtlZtest(double* source, double* output, int n, int period, double mu0) { if (source == null || output == null) return StatusCodes.QTL_ERR_NULL_PTR; if (n <= 0) return StatusCodes.QTL_ERR_INVALID_LENGTH; try { Ztest.Batch(Src(source, n), Dst(output, n), period, mu0); return StatusCodes.QTL_OK; } catch { return StatusCodes.QTL_ERR_INTERNAL; } } }