//
// Generated from bindings/c/include/wickra.h. Do not edit by hand.
using System.Runtime.InteropServices;
namespace Wickra;
public readonly record struct AccelerationBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct AdxOutput(double PlusDi, double MinusDi, double Adx);
public readonly record struct AlligatorOutput(double Jaw, double Teeth, double Lips);
public readonly record struct AndrewsPitchforkOutput(double Median, double Upper, double Lower);
public readonly record struct AroonOutput(double Up, double Down);
public readonly record struct AtrBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct AtrRatchetOutput(double Value, double Direction);
public readonly record struct AutoFibOutput(double Level0, double Level236, double Level382, double Level500, double Level618, double Level786, double Level1000);
public readonly record struct BollingerOutput(double Upper, double Middle, double Lower, double Stddev);
public readonly record struct BomarBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct CamarillaPivotsOutput(double Pp, double R1, double R2, double R3, double R4, double S1, double S2, double S3, double S4);
public readonly record struct CandleVolumeOutput(double Body, double Width);
public readonly record struct CentralPivotRangeOutput(double Pivot, double Tc, double Bc);
public readonly record struct ChandeKrollStopOutput(double StopLong, double StopShort);
public readonly record struct ChandelierExitOutput(double LongStop, double ShortStop);
public readonly record struct ClassicPivotsOutput(double Pp, double R1, double R2, double R3, double S1, double S2, double S3);
public readonly record struct CointegrationOutput(double HedgeRatio, double Spread, double AdfStat);
public readonly record struct CompositeProfileOutput(double Poc, double Vah, double Val);
public readonly record struct DemarkPivotsOutput(double Pp, double R1, double S1);
public readonly record struct DollarBar(double Open, double High, double Low, double Close, double Volume, double Dollar);
public readonly record struct DonchianOutput(double Upper, double Middle, double Lower);
public readonly record struct DonchianStopOutput(double StopLong, double StopShort);
public readonly record struct DoubleBollingerOutput(double UpperOuter, double UpperInner, double Middle, double LowerInner, double LowerOuter);
public readonly record struct ElderRayOutput(double BullPower, double BearPower);
public readonly record struct ElderSafeZoneOutput(double Value, double Direction);
public readonly record struct EquivolumeOutput(double Height, double Width);
public readonly record struct FibArcsOutput(double Arc382, double Arc500, double Arc618);
public readonly record struct FibChannelOutput(double Base, double Level618, double Level1000, double Level1618);
public readonly record struct FibConfluenceOutput(double Price, double Strength);
public readonly record struct FibExtensionOutput(double Level1272, double Level1414, double Level1618, double Level2000, double Level2618);
public readonly record struct FibFanOutput(double Fan382, double Fan500, double Fan618);
public readonly record struct FibProjectionOutput(double Level618, double Level1000, double Level1618, double Level2618);
public readonly record struct FibRetracementOutput(double Level0, double Level236, double Level382, double Level500, double Level618, double Level786, double Level1000);
public readonly record struct FibTimeZonesOutput(double OnZone, double BarsToNext);
public readonly record struct FibonacciPivotsOutput(double Pp, double R1, double R2, double R3, double S1, double S2, double S3);
public readonly record struct FootprintLevel(double Price, double BidVol, double AskVol);
public readonly record struct FractalChaosBandsOutput(double Upper, double Lower);
public readonly record struct GatorOscillatorOutput(double Upper, double Lower);
public readonly record struct GoldenPocketOutput(double Low, double Mid, double High);
public readonly record struct HeikinAshiOutput(double Open, double High, double Low, double Close);
public readonly record struct HighLowVolumeNodesOutput(double Hvn, double Lvn);
public readonly record struct HtPhasorOutput(double Inphase, double Quadrature);
public readonly record struct HurstChannelOutput(double Upper, double Middle, double Lower);
public readonly record struct IchimokuOutput(double Tenkan, double Kijun, double SenkouA, double SenkouB, double Chikou);
public readonly record struct ImbalanceBar(double Open, double High, double Low, double Close, double Imbalance, double Direction);
public readonly record struct InitialBalanceOutput(double High, double Low);
public readonly record struct KagiBar(double Start, double End, double Direction);
public readonly record struct KalmanHedgeRatioOutput(double HedgeRatio, double Intercept, double Spread);
public readonly record struct KaseDevStopOutput(double Value, double Direction);
public readonly record struct KasePermissionStochasticOutput(double Fast, double Slow);
public readonly record struct KeltnerOutput(double Upper, double Middle, double Lower);
public readonly record struct KstOutput(double Kst, double Signal);
public readonly record struct LeadLagCrossCorrelationOutput(double Lag, double Correlation);
public readonly record struct LinRegChannelOutput(double Upper, double Middle, double Lower);
public readonly record struct LineBreakBar(double Open, double Close, double Direction);
public readonly record struct LiquidationFeaturesOutput(double Long, double Short, double Net, double Total, double Imbalance);
public readonly record struct MaEnvelopeOutput(double Upper, double Middle, double Lower);
public readonly record struct MacdOutput(double Macd, double Signal, double Histogram);
public readonly record struct MamaOutput(double Mama, double Fama);
public readonly record struct MedianChannelOutput(double Upper, double Middle, double Lower);
public readonly record struct ModifiedMaStopOutput(double Value, double Direction);
public readonly record struct MurreyMathLinesOutput(double Mm88, double Mm78, double Mm68, double Mm58, double Mm48, double Mm38, double Mm28, double Mm18, double Mm08);
public readonly record struct NrtrOutput(double Value, double Direction);
public readonly record struct OpeningRangeOutput(double High, double Low, double BreakoutDistance);
public readonly record struct OvernightIntradayReturnOutput(double Overnight, double Intraday);
public readonly record struct PnfColumn(double Direction, double High, double Low);
public readonly record struct ProjectionBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct QqeOutput(double RsiMa, double TrailingLine);
public readonly record struct QuartileBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct RangeBar(double Open, double Close, double Direction);
public readonly record struct RelativeStrengthOutput(double Ratio, double RatioMa, double RatioRsi);
public readonly record struct RenkoBrick(double Open, double Close, double Direction);
public readonly record struct RunBar(double Open, double High, double Low, double Close, double Length, double Direction);
public readonly record struct RwiOutput(double High, double Low);
public readonly record struct SessionHighLowOutput(double High, double Low);
public readonly record struct SessionRangeOutput(double Asia, double Eu, double Us);
public readonly record struct SmoothedHeikinAshiOutput(double Open, double High, double Low, double Close);
public readonly record struct SpreadBollingerBandsOutput(double Middle, double Upper, double Lower, double PercentB);
public readonly record struct StandardErrorBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct StarcBandsOutput(double Upper, double Middle, double Lower);
public readonly record struct StochasticOutput(double K, double D);
public readonly record struct SuperTrendOutput(double Value, double Direction);
public readonly record struct TdLinesOutput(double Resistance, double Support);
public readonly record struct TdMovingAverageOutput(double St1, double St2);
public readonly record struct TdRangeProjectionOutput(double High, double Low);
public readonly record struct TdRiskLevelOutput(double BuyRisk, double SellRisk);
public readonly record struct TdSequentialOutput(double Setup, double Countdown, double Direction);
public readonly record struct TickBar(double Open, double High, double Low, double Close, double Volume);
public readonly record struct TpoProfileOutputScalars(double PriceLow, double PriceHigh, double[] Values);
public readonly record struct TtmSqueezeOutput(double Squeeze, double Momentum);
public readonly record struct ValueAreaOutput(double Poc, double Vah, double Val);
public readonly record struct VolatilityConeOutput(double Current, double Min, double Median, double Max, double Percentile);
public readonly record struct VolumeBar(double Open, double High, double Low, double Close, double Volume);
public readonly record struct VolumeProfileOutputScalars(double PriceLow, double PriceHigh, double[] Values);
public readonly record struct VolumeWeightedMacdOutput(double Macd, double Signal, double Histogram);
public readonly record struct VolumeWeightedSrOutput(double Support, double Resistance);
public readonly record struct VortexOutput(double Plus, double Minus);
public readonly record struct VwapStdDevBandsOutput(double Upper, double Middle, double Lower, double Stddev);
public readonly record struct WaveTrendOutput(double Wt1, double Wt2);
public readonly record struct WilliamsFractalsOutput(double Up, double Down);
public readonly record struct WoodiePivotsOutput(double Pp, double R1, double R2, double S1, double S2);
public readonly record struct ZeroLagMacdOutput(double Macd, double Signal, double Histogram);
public readonly record struct ZigZagOutput(double Swing, double Direction);
public sealed class AbandonedBaby : IDisposable
{
private readonly WickraHandle _handle;
public AbandonedBaby()
{
var ptr = NativeMethods.wickra_abandoned_baby_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AbandonedBaby parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_abandoned_baby_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_abandoned_baby_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_abandoned_baby_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_abandoned_baby_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Abcd : IDisposable
{
private readonly WickraHandle _handle;
public Abcd()
{
var ptr = NativeMethods.wickra_abcd_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Abcd parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_abcd_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_abcd_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_abcd_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_abcd_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AbsoluteBreadthIndex : IDisposable
{
private readonly WickraHandle _handle;
public AbsoluteBreadthIndex()
{
var ptr = NativeMethods.wickra_absolute_breadth_index_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AbsoluteBreadthIndex parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_absolute_breadth_index_free);
}
public double Update(ReadOnlySpan change, ReadOnlySpan volume, ReadOnlySpan newHigh, ReadOnlySpan newLow, ReadOnlySpan aboveMa, ReadOnlySpan onBuySignal, long timestamp)
{
if (volume.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newHigh.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newLow.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (aboveMa.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (onBuySignal.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
double result;
unsafe
{
fixed (double* changePtr = change)
fixed (double* volumePtr = volume)
fixed (bool* newHighPtr = newHigh)
fixed (bool* newLowPtr = newLow)
fixed (bool* aboveMaPtr = aboveMa)
fixed (bool* onBuySignalPtr = onBuySignal)
{
result = NativeMethods.wickra_absolute_breadth_index_update(_handle.DangerousGetHandle(), changePtr, volumePtr, newHighPtr, newLowPtr, aboveMaPtr, onBuySignalPtr, (nuint)change.Length, timestamp);
}
}
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_absolute_breadth_index_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AccelerationBands : IDisposable
{
private readonly WickraHandle _handle;
public AccelerationBands(int period, double factor)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_acceleration_bands_new((nuint)period, factor);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AccelerationBands parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_acceleration_bands_free);
}
public AccelerationBandsOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAccelerationBandsOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_acceleration_bands_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AccelerationBandsOutput(native.upper, native.middle, native.lower) : null;
}
public void Reset()
{
NativeMethods.wickra_acceleration_bands_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AcceleratorOscillator : IDisposable
{
private readonly WickraHandle _handle;
public AcceleratorOscillator(int aoFast, int aoSlow, int signalPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(aoFast);
ArgumentOutOfRangeException.ThrowIfNegative(aoSlow);
ArgumentOutOfRangeException.ThrowIfNegative(signalPeriod);
var ptr = NativeMethods.wickra_accelerator_oscillator_new((nuint)aoFast, (nuint)aoSlow, (nuint)signalPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AcceleratorOscillator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_accelerator_oscillator_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_accelerator_oscillator_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_accelerator_oscillator_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_accelerator_oscillator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdOscillator : IDisposable
{
private readonly WickraHandle _handle;
public AdOscillator()
{
var ptr = NativeMethods.wickra_ad_oscillator_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdOscillator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_ad_oscillator_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_ad_oscillator_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_ad_oscillator_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_ad_oscillator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdVolumeLine : IDisposable
{
private readonly WickraHandle _handle;
public AdVolumeLine()
{
var ptr = NativeMethods.wickra_ad_volume_line_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdVolumeLine parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_ad_volume_line_free);
}
public double Update(ReadOnlySpan change, ReadOnlySpan volume, ReadOnlySpan newHigh, ReadOnlySpan newLow, ReadOnlySpan aboveMa, ReadOnlySpan onBuySignal, long timestamp)
{
if (volume.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newHigh.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newLow.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (aboveMa.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (onBuySignal.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
double result;
unsafe
{
fixed (double* changePtr = change)
fixed (double* volumePtr = volume)
fixed (bool* newHighPtr = newHigh)
fixed (bool* newLowPtr = newLow)
fixed (bool* aboveMaPtr = aboveMa)
fixed (bool* onBuySignalPtr = onBuySignal)
{
result = NativeMethods.wickra_ad_volume_line_update(_handle.DangerousGetHandle(), changePtr, volumePtr, newHighPtr, newLowPtr, aboveMaPtr, onBuySignalPtr, (nuint)change.Length, timestamp);
}
}
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_ad_volume_line_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdaptiveCci : IDisposable
{
private readonly WickraHandle _handle;
public AdaptiveCci(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_adaptive_cci_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdaptiveCci parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adaptive_cci_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_adaptive_cci_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_adaptive_cci_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_adaptive_cci_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdaptiveCycle : IDisposable
{
private readonly WickraHandle _handle;
public AdaptiveCycle()
{
var ptr = NativeMethods.wickra_adaptive_cycle_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdaptiveCycle parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adaptive_cycle_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_adaptive_cycle_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_adaptive_cycle_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_adaptive_cycle_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdaptiveLaguerreFilter : IDisposable
{
private readonly WickraHandle _handle;
public AdaptiveLaguerreFilter(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_adaptive_laguerre_filter_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdaptiveLaguerreFilter parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adaptive_laguerre_filter_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_adaptive_laguerre_filter_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_adaptive_laguerre_filter_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_adaptive_laguerre_filter_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdaptiveRsi : IDisposable
{
private readonly WickraHandle _handle;
public AdaptiveRsi(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_adaptive_rsi_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdaptiveRsi parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adaptive_rsi_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_adaptive_rsi_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_adaptive_rsi_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_adaptive_rsi_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Adl : IDisposable
{
private readonly WickraHandle _handle;
public Adl()
{
var ptr = NativeMethods.wickra_adl_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Adl parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adl_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_adl_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_adl_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_adl_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdvanceBlock : IDisposable
{
private readonly WickraHandle _handle;
public AdvanceBlock()
{
var ptr = NativeMethods.wickra_advance_block_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdvanceBlock parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_advance_block_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_advance_block_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_advance_block_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_advance_block_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdvanceDecline : IDisposable
{
private readonly WickraHandle _handle;
public AdvanceDecline()
{
var ptr = NativeMethods.wickra_advance_decline_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdvanceDecline parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_advance_decline_free);
}
public double Update(ReadOnlySpan change, ReadOnlySpan volume, ReadOnlySpan newHigh, ReadOnlySpan newLow, ReadOnlySpan aboveMa, ReadOnlySpan onBuySignal, long timestamp)
{
if (volume.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newHigh.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newLow.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (aboveMa.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (onBuySignal.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
double result;
unsafe
{
fixed (double* changePtr = change)
fixed (double* volumePtr = volume)
fixed (bool* newHighPtr = newHigh)
fixed (bool* newLowPtr = newLow)
fixed (bool* aboveMaPtr = aboveMa)
fixed (bool* onBuySignalPtr = onBuySignal)
{
result = NativeMethods.wickra_advance_decline_update(_handle.DangerousGetHandle(), changePtr, volumePtr, newHighPtr, newLowPtr, aboveMaPtr, onBuySignalPtr, (nuint)change.Length, timestamp);
}
}
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_advance_decline_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AdvanceDeclineRatio : IDisposable
{
private readonly WickraHandle _handle;
public AdvanceDeclineRatio()
{
var ptr = NativeMethods.wickra_advance_decline_ratio_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AdvanceDeclineRatio parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_advance_decline_ratio_free);
}
public double Update(ReadOnlySpan change, ReadOnlySpan volume, ReadOnlySpan newHigh, ReadOnlySpan newLow, ReadOnlySpan aboveMa, ReadOnlySpan onBuySignal, long timestamp)
{
if (volume.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newHigh.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newLow.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (aboveMa.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (onBuySignal.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
double result;
unsafe
{
fixed (double* changePtr = change)
fixed (double* volumePtr = volume)
fixed (bool* newHighPtr = newHigh)
fixed (bool* newLowPtr = newLow)
fixed (bool* aboveMaPtr = aboveMa)
fixed (bool* onBuySignalPtr = onBuySignal)
{
result = NativeMethods.wickra_advance_decline_ratio_update(_handle.DangerousGetHandle(), changePtr, volumePtr, newHighPtr, newLowPtr, aboveMaPtr, onBuySignalPtr, (nuint)change.Length, timestamp);
}
}
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_advance_decline_ratio_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Adx : IDisposable
{
private readonly WickraHandle _handle;
public Adx(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_adx_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Adx parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adx_free);
}
public AdxOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAdxOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_adx_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AdxOutput(native.plus_di, native.minus_di, native.adx) : null;
}
public void Reset()
{
NativeMethods.wickra_adx_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Adxr : IDisposable
{
private readonly WickraHandle _handle;
public Adxr(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_adxr_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Adxr parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_adxr_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_adxr_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_adxr_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_adxr_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Alligator : IDisposable
{
private readonly WickraHandle _handle;
public Alligator(int jawPeriod, int teethPeriod, int lipsPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(jawPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(teethPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(lipsPeriod);
var ptr = NativeMethods.wickra_alligator_new((nuint)jawPeriod, (nuint)teethPeriod, (nuint)lipsPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Alligator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_alligator_free);
}
public AlligatorOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAlligatorOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_alligator_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AlligatorOutput(native.jaw, native.teeth, native.lips) : null;
}
public void Reset()
{
NativeMethods.wickra_alligator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Alma : IDisposable
{
private readonly WickraHandle _handle;
public Alma(int period, double offset, double sigma)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_alma_new((nuint)period, offset, sigma);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Alma parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_alma_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_alma_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_alma_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_alma_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Alpha : IDisposable
{
private readonly WickraHandle _handle;
public Alpha(int period, double riskFree)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_alpha_new((nuint)period, riskFree);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Alpha parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_alpha_free);
}
public double Update(double x, double y)
{
var result = NativeMethods.wickra_alpha_update(_handle.DangerousGetHandle(), x, y);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan x, ReadOnlySpan y)
{
var n = x.Length;
if (y.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* xPtr = x)
fixed (double* yPtr = y)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_alpha_batch(_handle.DangerousGetHandle(), xPtr, yPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_alpha_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AmihudIlliquidity : IDisposable
{
private readonly WickraHandle _handle;
public AmihudIlliquidity(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_amihud_illiquidity_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AmihudIlliquidity parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_amihud_illiquidity_free);
}
public double Update(double price, double size, bool isBuy, long timestamp)
{
var result = NativeMethods.wickra_amihud_illiquidity_update(_handle.DangerousGetHandle(), price, size, isBuy, timestamp);
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_amihud_illiquidity_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AnchoredRsi : IDisposable
{
private readonly WickraHandle _handle;
public AnchoredRsi()
{
var ptr = NativeMethods.wickra_anchored_rsi_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AnchoredRsi parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_anchored_rsi_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_anchored_rsi_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_anchored_rsi_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_anchored_rsi_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AnchoredVwap : IDisposable
{
private readonly WickraHandle _handle;
public AnchoredVwap()
{
var ptr = NativeMethods.wickra_anchored_vwap_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AnchoredVwap parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_anchored_vwap_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_anchored_vwap_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_anchored_vwap_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_anchored_vwap_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AndrewsPitchfork : IDisposable
{
private readonly WickraHandle _handle;
public AndrewsPitchfork(int strength)
{
ArgumentOutOfRangeException.ThrowIfNegative(strength);
var ptr = NativeMethods.wickra_andrews_pitchfork_new((nuint)strength);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AndrewsPitchfork parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_andrews_pitchfork_free);
}
public AndrewsPitchforkOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAndrewsPitchforkOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_andrews_pitchfork_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AndrewsPitchforkOutput(native.median, native.upper, native.lower) : null;
}
public void Reset()
{
NativeMethods.wickra_andrews_pitchfork_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Apo : IDisposable
{
private readonly WickraHandle _handle;
public Apo(int fast, int slow)
{
ArgumentOutOfRangeException.ThrowIfNegative(fast);
ArgumentOutOfRangeException.ThrowIfNegative(slow);
var ptr = NativeMethods.wickra_apo_new((nuint)fast, (nuint)slow);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Apo parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_apo_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_apo_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_apo_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_apo_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Aroon : IDisposable
{
private readonly WickraHandle _handle;
public Aroon(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_aroon_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Aroon parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_aroon_free);
}
public AroonOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAroonOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_aroon_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AroonOutput(native.up, native.down) : null;
}
public void Reset()
{
NativeMethods.wickra_aroon_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AroonOscillator : IDisposable
{
private readonly WickraHandle _handle;
public AroonOscillator(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_aroon_oscillator_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AroonOscillator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_aroon_oscillator_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_aroon_oscillator_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_aroon_oscillator_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_aroon_oscillator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Atr : IDisposable
{
private readonly WickraHandle _handle;
public Atr(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_atr_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Atr parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_atr_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_atr_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_atr_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_atr_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AtrBands : IDisposable
{
private readonly WickraHandle _handle;
public AtrBands(int period, double multiplier)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_atr_bands_new((nuint)period, multiplier);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AtrBands parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_atr_bands_free);
}
public AtrBandsOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAtrBandsOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_atr_bands_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AtrBandsOutput(native.upper, native.middle, native.lower) : null;
}
public void Reset()
{
NativeMethods.wickra_atr_bands_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AtrRatchet : IDisposable
{
private readonly WickraHandle _handle;
public AtrRatchet(int atrPeriod, double startMult, double increment)
{
ArgumentOutOfRangeException.ThrowIfNegative(atrPeriod);
var ptr = NativeMethods.wickra_atr_ratchet_new((nuint)atrPeriod, startMult, increment);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AtrRatchet parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_atr_ratchet_free);
}
public AtrRatchetOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAtrRatchetOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_atr_ratchet_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AtrRatchetOutput(native.@value, native.direction) : null;
}
public void Reset()
{
NativeMethods.wickra_atr_ratchet_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AtrTrailingStop : IDisposable
{
private readonly WickraHandle _handle;
public AtrTrailingStop(int atrPeriod, double multiplier)
{
ArgumentOutOfRangeException.ThrowIfNegative(atrPeriod);
var ptr = NativeMethods.wickra_atr_trailing_stop_new((nuint)atrPeriod, multiplier);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AtrTrailingStop parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_atr_trailing_stop_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_atr_trailing_stop_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_atr_trailing_stop_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_atr_trailing_stop_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AutoFib : IDisposable
{
private readonly WickraHandle _handle;
public AutoFib()
{
var ptr = NativeMethods.wickra_auto_fib_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AutoFib parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_auto_fib_free);
}
public AutoFibOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraAutoFibOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_auto_fib_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new AutoFibOutput(native.level_0, native.level_236, native.level_382, native.level_500, native.level_618, native.level_786, native.level_1000) : null;
}
public void Reset()
{
NativeMethods.wickra_auto_fib_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Autocorrelation : IDisposable
{
private readonly WickraHandle _handle;
public Autocorrelation(int period, int lag)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
ArgumentOutOfRangeException.ThrowIfNegative(lag);
var ptr = NativeMethods.wickra_autocorrelation_new((nuint)period, (nuint)lag);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Autocorrelation parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_autocorrelation_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_autocorrelation_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_autocorrelation_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_autocorrelation_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AutocorrelationPeriodogram : IDisposable
{
private readonly WickraHandle _handle;
public AutocorrelationPeriodogram(int minPeriod, int maxPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(minPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(maxPeriod);
var ptr = NativeMethods.wickra_autocorrelation_periodogram_new((nuint)minPeriod, (nuint)maxPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AutocorrelationPeriodogram parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_autocorrelation_periodogram_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_autocorrelation_periodogram_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_autocorrelation_periodogram_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_autocorrelation_periodogram_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AverageDailyRange : IDisposable
{
private readonly WickraHandle _handle;
public AverageDailyRange(int period, int utcOffsetMinutes)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_average_daily_range_new((nuint)period, utcOffsetMinutes);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AverageDailyRange parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_average_daily_range_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_average_daily_range_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_average_daily_range_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_average_daily_range_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AverageDrawdown : IDisposable
{
private readonly WickraHandle _handle;
public AverageDrawdown(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_average_drawdown_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AverageDrawdown parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_average_drawdown_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_average_drawdown_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_average_drawdown_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_average_drawdown_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AvgPrice : IDisposable
{
private readonly WickraHandle _handle;
public AvgPrice()
{
var ptr = NativeMethods.wickra_avg_price_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AvgPrice parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_avg_price_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_avg_price_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_avg_price_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_avg_price_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AwesomeOscillator : IDisposable
{
private readonly WickraHandle _handle;
public AwesomeOscillator(int fast, int slow)
{
ArgumentOutOfRangeException.ThrowIfNegative(fast);
ArgumentOutOfRangeException.ThrowIfNegative(slow);
var ptr = NativeMethods.wickra_awesome_oscillator_new((nuint)fast, (nuint)slow);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AwesomeOscillator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_awesome_oscillator_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_awesome_oscillator_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_awesome_oscillator_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_awesome_oscillator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class AwesomeOscillatorHistogram : IDisposable
{
private readonly WickraHandle _handle;
public AwesomeOscillatorHistogram(int fast, int slow, int smaPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(fast);
ArgumentOutOfRangeException.ThrowIfNegative(slow);
ArgumentOutOfRangeException.ThrowIfNegative(smaPeriod);
var ptr = NativeMethods.wickra_awesome_oscillator_histogram_new((nuint)fast, (nuint)slow, (nuint)smaPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid AwesomeOscillatorHistogram parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_awesome_oscillator_histogram_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_awesome_oscillator_histogram_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_awesome_oscillator_histogram_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_awesome_oscillator_histogram_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BalanceOfPower : IDisposable
{
private readonly WickraHandle _handle;
public BalanceOfPower()
{
var ptr = NativeMethods.wickra_balance_of_power_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BalanceOfPower parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_balance_of_power_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_balance_of_power_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_balance_of_power_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_balance_of_power_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BandpassFilter : IDisposable
{
private readonly WickraHandle _handle;
public BandpassFilter(int period, double bandwidth)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_bandpass_filter_new((nuint)period, bandwidth);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BandpassFilter parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bandpass_filter_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_bandpass_filter_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_bandpass_filter_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_bandpass_filter_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Bat : IDisposable
{
private readonly WickraHandle _handle;
public Bat()
{
var ptr = NativeMethods.wickra_bat_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Bat parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bat_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_bat_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_bat_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_bat_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BeltHold : IDisposable
{
private readonly WickraHandle _handle;
public BeltHold()
{
var ptr = NativeMethods.wickra_belt_hold_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BeltHold parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_belt_hold_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_belt_hold_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_belt_hold_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_belt_hold_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Beta : IDisposable
{
private readonly WickraHandle _handle;
public Beta(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_beta_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Beta parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_beta_free);
}
public double Update(double x, double y)
{
var result = NativeMethods.wickra_beta_update(_handle.DangerousGetHandle(), x, y);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan x, ReadOnlySpan y)
{
var n = x.Length;
if (y.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* xPtr = x)
fixed (double* yPtr = y)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_beta_batch(_handle.DangerousGetHandle(), xPtr, yPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_beta_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BetaNeutralSpread : IDisposable
{
private readonly WickraHandle _handle;
public BetaNeutralSpread(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_beta_neutral_spread_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BetaNeutralSpread parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_beta_neutral_spread_free);
}
public double Update(double x, double y)
{
var result = NativeMethods.wickra_beta_neutral_spread_update(_handle.DangerousGetHandle(), x, y);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan x, ReadOnlySpan y)
{
var n = x.Length;
if (y.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* xPtr = x)
fixed (double* yPtr = y)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_beta_neutral_spread_batch(_handle.DangerousGetHandle(), xPtr, yPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_beta_neutral_spread_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BetterVolume : IDisposable
{
private readonly WickraHandle _handle;
public BetterVolume(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_better_volume_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BetterVolume parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_better_volume_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_better_volume_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_better_volume_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_better_volume_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BipowerVariation : IDisposable
{
private readonly WickraHandle _handle;
public BipowerVariation(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_bipower_variation_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BipowerVariation parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bipower_variation_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_bipower_variation_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_bipower_variation_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_bipower_variation_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BodySizePct : IDisposable
{
private readonly WickraHandle _handle;
public BodySizePct()
{
var ptr = NativeMethods.wickra_body_size_pct_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BodySizePct parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_body_size_pct_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_body_size_pct_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_body_size_pct_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_body_size_pct_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BollingerBands : IDisposable
{
private readonly WickraHandle _handle;
public BollingerBands(int period, double multiplier)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_bollinger_bands_new((nuint)period, multiplier);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BollingerBands parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bollinger_bands_free);
}
public BollingerOutput? Update(double @value)
{
WickraBollingerOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_bollinger_bands_update(_handle.DangerousGetHandle(), @value, &native);
}
GC.KeepAlive(_handle);
return ok ? new BollingerOutput(native.upper, native.middle, native.lower, native.stddev) : null;
}
public void Reset()
{
NativeMethods.wickra_bollinger_bands_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BollingerBandwidth : IDisposable
{
private readonly WickraHandle _handle;
public BollingerBandwidth(int period, double multiplier)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_bollinger_bandwidth_new((nuint)period, multiplier);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BollingerBandwidth parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bollinger_bandwidth_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_bollinger_bandwidth_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_bollinger_bandwidth_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_bollinger_bandwidth_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BomarBands : IDisposable
{
private readonly WickraHandle _handle;
public BomarBands(int period, double coverage)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_bomar_bands_new((nuint)period, coverage);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BomarBands parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bomar_bands_free);
}
public BomarBandsOutput? Update(double @value)
{
WickraBomarBandsOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_bomar_bands_update(_handle.DangerousGetHandle(), @value, &native);
}
GC.KeepAlive(_handle);
return ok ? new BomarBandsOutput(native.upper, native.middle, native.lower) : null;
}
public void Reset()
{
NativeMethods.wickra_bomar_bands_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BreadthThrust : IDisposable
{
private readonly WickraHandle _handle;
public BreadthThrust(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_breadth_thrust_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BreadthThrust parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_breadth_thrust_free);
}
public double Update(ReadOnlySpan change, ReadOnlySpan volume, ReadOnlySpan newHigh, ReadOnlySpan newLow, ReadOnlySpan aboveMa, ReadOnlySpan onBuySignal, long timestamp)
{
if (volume.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newHigh.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newLow.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (aboveMa.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (onBuySignal.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
double result;
unsafe
{
fixed (double* changePtr = change)
fixed (double* volumePtr = volume)
fixed (bool* newHighPtr = newHigh)
fixed (bool* newLowPtr = newLow)
fixed (bool* aboveMaPtr = aboveMa)
fixed (bool* onBuySignalPtr = onBuySignal)
{
result = NativeMethods.wickra_breadth_thrust_update(_handle.DangerousGetHandle(), changePtr, volumePtr, newHighPtr, newLowPtr, aboveMaPtr, onBuySignalPtr, (nuint)change.Length, timestamp);
}
}
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_breadth_thrust_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Breakaway : IDisposable
{
private readonly WickraHandle _handle;
public Breakaway()
{
var ptr = NativeMethods.wickra_breakaway_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Breakaway parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_breakaway_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_breakaway_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_breakaway_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_breakaway_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BullishPercentIndex : IDisposable
{
private readonly WickraHandle _handle;
public BullishPercentIndex()
{
var ptr = NativeMethods.wickra_bullish_percent_index_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BullishPercentIndex parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_bullish_percent_index_free);
}
public double Update(ReadOnlySpan change, ReadOnlySpan volume, ReadOnlySpan newHigh, ReadOnlySpan newLow, ReadOnlySpan aboveMa, ReadOnlySpan onBuySignal, long timestamp)
{
if (volume.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newHigh.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (newLow.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (aboveMa.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
if (onBuySignal.Length != change.Length)
{
throw new ArgumentException("input spans in the same group must have equal length");
}
double result;
unsafe
{
fixed (double* changePtr = change)
fixed (double* volumePtr = volume)
fixed (bool* newHighPtr = newHigh)
fixed (bool* newLowPtr = newLow)
fixed (bool* aboveMaPtr = aboveMa)
fixed (bool* onBuySignalPtr = onBuySignal)
{
result = NativeMethods.wickra_bullish_percent_index_update(_handle.DangerousGetHandle(), changePtr, volumePtr, newHighPtr, newLowPtr, aboveMaPtr, onBuySignalPtr, (nuint)change.Length, timestamp);
}
}
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_bullish_percent_index_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class BurkeRatio : IDisposable
{
private readonly WickraHandle _handle;
public BurkeRatio(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_burke_ratio_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid BurkeRatio parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_burke_ratio_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_burke_ratio_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_burke_ratio_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_burke_ratio_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Butterfly : IDisposable
{
private readonly WickraHandle _handle;
public Butterfly()
{
var ptr = NativeMethods.wickra_butterfly_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Butterfly parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_butterfly_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_butterfly_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_butterfly_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_butterfly_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CalendarSpread : IDisposable
{
private readonly WickraHandle _handle;
public CalendarSpread()
{
var ptr = NativeMethods.wickra_calendar_spread_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CalendarSpread parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_calendar_spread_free);
}
public double Update(double fundingRate, double markPrice, double indexPrice, double futuresPrice, double openInterest, double longSize, double shortSize, double takerBuyVolume, double takerSellVolume, double longLiquidation, double shortLiquidation, long timestamp)
{
var result = NativeMethods.wickra_calendar_spread_update(_handle.DangerousGetHandle(), fundingRate, markPrice, indexPrice, futuresPrice, openInterest, longSize, shortSize, takerBuyVolume, takerSellVolume, longLiquidation, shortLiquidation, timestamp);
GC.KeepAlive(_handle);
return result;
}
public void Reset()
{
NativeMethods.wickra_calendar_spread_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CalmarRatio : IDisposable
{
private readonly WickraHandle _handle;
public CalmarRatio(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_calmar_ratio_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CalmarRatio parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_calmar_ratio_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_calmar_ratio_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_calmar_ratio_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_calmar_ratio_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Camarilla : IDisposable
{
private readonly WickraHandle _handle;
public Camarilla()
{
var ptr = NativeMethods.wickra_camarilla_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Camarilla parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_camarilla_free);
}
public CamarillaPivotsOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraCamarillaPivotsOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_camarilla_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new CamarillaPivotsOutput(native.pp, native.r1, native.r2, native.r3, native.r4, native.s1, native.s2, native.s3, native.s4) : null;
}
public void Reset()
{
NativeMethods.wickra_camarilla_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CandleVolume : IDisposable
{
private readonly WickraHandle _handle;
public CandleVolume(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_candle_volume_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CandleVolume parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_candle_volume_free);
}
public CandleVolumeOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraCandleVolumeOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_candle_volume_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new CandleVolumeOutput(native.body, native.width) : null;
}
public void Reset()
{
NativeMethods.wickra_candle_volume_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Cci : IDisposable
{
private readonly WickraHandle _handle;
public Cci(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_cci_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Cci parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_cci_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_cci_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_cci_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_cci_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CenterOfGravity : IDisposable
{
private readonly WickraHandle _handle;
public CenterOfGravity(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_center_of_gravity_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CenterOfGravity parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_center_of_gravity_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_center_of_gravity_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_center_of_gravity_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_center_of_gravity_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CentralPivotRange : IDisposable
{
private readonly WickraHandle _handle;
public CentralPivotRange()
{
var ptr = NativeMethods.wickra_central_pivot_range_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CentralPivotRange parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_central_pivot_range_free);
}
public CentralPivotRangeOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraCentralPivotRangeOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_central_pivot_range_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new CentralPivotRangeOutput(native.pivot, native.tc, native.bc) : null;
}
public void Reset()
{
NativeMethods.wickra_central_pivot_range_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Cfo : IDisposable
{
private readonly WickraHandle _handle;
public Cfo(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_cfo_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Cfo parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_cfo_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_cfo_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_cfo_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_cfo_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ChaikinMoneyFlow : IDisposable
{
private readonly WickraHandle _handle;
public ChaikinMoneyFlow(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_chaikin_money_flow_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ChaikinMoneyFlow parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_chaikin_money_flow_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_chaikin_money_flow_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_chaikin_money_flow_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_chaikin_money_flow_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ChaikinOscillator : IDisposable
{
private readonly WickraHandle _handle;
public ChaikinOscillator(int fast, int slow)
{
ArgumentOutOfRangeException.ThrowIfNegative(fast);
ArgumentOutOfRangeException.ThrowIfNegative(slow);
var ptr = NativeMethods.wickra_chaikin_oscillator_new((nuint)fast, (nuint)slow);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ChaikinOscillator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_chaikin_oscillator_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_chaikin_oscillator_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_chaikin_oscillator_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_chaikin_oscillator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ChaikinVolatility : IDisposable
{
private readonly WickraHandle _handle;
public ChaikinVolatility(int emaPeriod, int rocPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(emaPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(rocPeriod);
var ptr = NativeMethods.wickra_chaikin_volatility_new((nuint)emaPeriod, (nuint)rocPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ChaikinVolatility parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_chaikin_volatility_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_chaikin_volatility_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_chaikin_volatility_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_chaikin_volatility_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ChandeKrollStop : IDisposable
{
private readonly WickraHandle _handle;
public ChandeKrollStop(int atrPeriod, double atrMultiplier, int stopPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(atrPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(stopPeriod);
var ptr = NativeMethods.wickra_chande_kroll_stop_new((nuint)atrPeriod, atrMultiplier, (nuint)stopPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ChandeKrollStop parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_chande_kroll_stop_free);
}
public ChandeKrollStopOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraChandeKrollStopOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_chande_kroll_stop_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new ChandeKrollStopOutput(native.stop_long, native.stop_short) : null;
}
public void Reset()
{
NativeMethods.wickra_chande_kroll_stop_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ChandelierExit : IDisposable
{
private readonly WickraHandle _handle;
public ChandelierExit(int period, double multiplier)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_chandelier_exit_new((nuint)period, multiplier);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ChandelierExit parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_chandelier_exit_free);
}
public ChandelierExitOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraChandelierExitOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_chandelier_exit_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new ChandelierExitOutput(native.long_stop, native.short_stop) : null;
}
public void Reset()
{
NativeMethods.wickra_chandelier_exit_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ChoppinessIndex : IDisposable
{
private readonly WickraHandle _handle;
public ChoppinessIndex(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_choppiness_index_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ChoppinessIndex parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_choppiness_index_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_choppiness_index_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_choppiness_index_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_choppiness_index_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ClassicPivots : IDisposable
{
private readonly WickraHandle _handle;
public ClassicPivots()
{
var ptr = NativeMethods.wickra_classic_pivots_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ClassicPivots parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_classic_pivots_free);
}
public ClassicPivotsOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraClassicPivotsOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_classic_pivots_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new ClassicPivotsOutput(native.pp, native.r1, native.r2, native.r3, native.s1, native.s2, native.s3) : null;
}
public void Reset()
{
NativeMethods.wickra_classic_pivots_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CloseVsOpen : IDisposable
{
private readonly WickraHandle _handle;
public CloseVsOpen()
{
var ptr = NativeMethods.wickra_close_vs_open_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CloseVsOpen parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_close_vs_open_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_close_vs_open_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_close_vs_open_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_close_vs_open_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ClosingMarubozu : IDisposable
{
private readonly WickraHandle _handle;
public ClosingMarubozu()
{
var ptr = NativeMethods.wickra_closing_marubozu_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ClosingMarubozu parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_closing_marubozu_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_closing_marubozu_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_closing_marubozu_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_closing_marubozu_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Cmo : IDisposable
{
private readonly WickraHandle _handle;
public Cmo(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_cmo_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Cmo parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_cmo_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_cmo_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_cmo_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_cmo_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CoefficientOfVariation : IDisposable
{
private readonly WickraHandle _handle;
public CoefficientOfVariation(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_coefficient_of_variation_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CoefficientOfVariation parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_coefficient_of_variation_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_coefficient_of_variation_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_coefficient_of_variation_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_coefficient_of_variation_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Cointegration : IDisposable
{
private readonly WickraHandle _handle;
public Cointegration(int period, int adfLags)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
ArgumentOutOfRangeException.ThrowIfNegative(adfLags);
var ptr = NativeMethods.wickra_cointegration_new((nuint)period, (nuint)adfLags);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Cointegration parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_cointegration_free);
}
public CointegrationOutput? Update(double x, double y)
{
WickraCointegrationOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_cointegration_update(_handle.DangerousGetHandle(), x, y, &native);
}
GC.KeepAlive(_handle);
return ok ? new CointegrationOutput(native.hedge_ratio, native.spread, native.adf_stat) : null;
}
public void Reset()
{
NativeMethods.wickra_cointegration_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CommonSenseRatio : IDisposable
{
private readonly WickraHandle _handle;
public CommonSenseRatio(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_common_sense_ratio_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CommonSenseRatio parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_common_sense_ratio_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_common_sense_ratio_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_common_sense_ratio_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_common_sense_ratio_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CompositeProfile : IDisposable
{
private readonly WickraHandle _handle;
public CompositeProfile(int period, int bins, double valueAreaPct)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
ArgumentOutOfRangeException.ThrowIfNegative(bins);
var ptr = NativeMethods.wickra_composite_profile_new((nuint)period, (nuint)bins, valueAreaPct);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CompositeProfile parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_composite_profile_free);
}
public CompositeProfileOutput? Update(double open, double high, double low, double close, double volume, long timestamp)
{
WickraCompositeProfileOutput native;
bool ok;
unsafe
{
ok = NativeMethods.wickra_composite_profile_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp, &native);
}
GC.KeepAlive(_handle);
return ok ? new CompositeProfileOutput(native.poc, native.vah, native.val) : null;
}
public void Reset()
{
NativeMethods.wickra_composite_profile_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ConcealingBabySwallow : IDisposable
{
private readonly WickraHandle _handle;
public ConcealingBabySwallow()
{
var ptr = NativeMethods.wickra_concealing_baby_swallow_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ConcealingBabySwallow parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_concealing_baby_swallow_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_concealing_baby_swallow_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan close, ReadOnlySpan volume, ReadOnlySpan timestamp)
{
var n = open.Length;
if (high.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (low.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (close.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (volume.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
if (timestamp.Length != n)
{
throw new ArgumentException("all input spans must have the same length");
}
var output = new double[n];
unsafe
{
fixed (double* openPtr = open)
fixed (double* highPtr = high)
fixed (double* lowPtr = low)
fixed (double* closePtr = close)
fixed (double* volumePtr = volume)
fixed (long* timestampPtr = timestamp)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_concealing_baby_swallow_batch(_handle.DangerousGetHandle(), openPtr, highPtr, lowPtr, closePtr, volumePtr, timestampPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_concealing_baby_swallow_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ConditionalValueAtRisk : IDisposable
{
private readonly WickraHandle _handle;
public ConditionalValueAtRisk(int period, double confidence)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_conditional_value_at_risk_new((nuint)period, confidence);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ConditionalValueAtRisk parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_conditional_value_at_risk_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_conditional_value_at_risk_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_conditional_value_at_risk_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_conditional_value_at_risk_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class ConnorsRsi : IDisposable
{
private readonly WickraHandle _handle;
public ConnorsRsi(int periodRsi, int periodStreak, int periodRank)
{
ArgumentOutOfRangeException.ThrowIfNegative(periodRsi);
ArgumentOutOfRangeException.ThrowIfNegative(periodStreak);
ArgumentOutOfRangeException.ThrowIfNegative(periodRank);
var ptr = NativeMethods.wickra_connors_rsi_new((nuint)periodRsi, (nuint)periodStreak, (nuint)periodRank);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid ConnorsRsi parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_connors_rsi_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_connors_rsi_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_connors_rsi_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_connors_rsi_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Coppock : IDisposable
{
private readonly WickraHandle _handle;
public Coppock(int rocLongPeriod, int rocShortPeriod, int wmaPeriod)
{
ArgumentOutOfRangeException.ThrowIfNegative(rocLongPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(rocShortPeriod);
ArgumentOutOfRangeException.ThrowIfNegative(wmaPeriod);
var ptr = NativeMethods.wickra_coppock_new((nuint)rocLongPeriod, (nuint)rocShortPeriod, (nuint)wmaPeriod);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Coppock parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_coppock_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_coppock_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_coppock_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_coppock_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class CorrelationTrendIndicator : IDisposable
{
private readonly WickraHandle _handle;
public CorrelationTrendIndicator(int period)
{
ArgumentOutOfRangeException.ThrowIfNegative(period);
var ptr = NativeMethods.wickra_correlation_trend_indicator_new((nuint)period);
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid CorrelationTrendIndicator parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_correlation_trend_indicator_free);
}
public double Update(double @value)
{
var result = NativeMethods.wickra_correlation_trend_indicator_update(_handle.DangerousGetHandle(), @value);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan input)
{
var n = input.Length;
var output = new double[n];
unsafe
{
fixed (double* inputPtr = input)
fixed (double* outputPtr = output)
{
NativeMethods.wickra_correlation_trend_indicator_batch(_handle.DangerousGetHandle(), inputPtr, outputPtr, (nuint)n);
}
}
GC.KeepAlive(_handle);
return output;
}
public void Reset()
{
NativeMethods.wickra_correlation_trend_indicator_reset(_handle.DangerousGetHandle());
GC.KeepAlive(_handle);
}
public void Dispose() => _handle.Dispose();
}
public sealed class Counterattack : IDisposable
{
private readonly WickraHandle _handle;
public Counterattack()
{
var ptr = NativeMethods.wickra_counterattack_new();
if (ptr == nint.Zero)
{
throw new ArgumentException("invalid Counterattack parameters");
}
_handle = new WickraHandle(ptr, NativeMethods.wickra_counterattack_free);
}
public double Update(double open, double high, double low, double close, double volume, long timestamp)
{
var result = NativeMethods.wickra_counterattack_update(_handle.DangerousGetHandle(), open, high, low, close, volume, timestamp);
GC.KeepAlive(_handle);
return result;
}
public double[] Batch(ReadOnlySpan open, ReadOnlySpan high, ReadOnlySpan low, ReadOnlySpan