/* Generated by gen_golden_test.py. DO NOT EDIT. * * Value-parity for the whole 514-indicator catalogue through the Wickra C ABI. * The same source compiles as C (gcc) and C++ (g++) since wickra.h is extern "C". * Each indicator replays the shared golden input and is checked bit-for-bit * against the Rust reference fixtures testdata/golden/g_.csv. */ #include #include #include #include #include #include "wickra.h" #define NANV (nan("")) #define MAXROWS 512 #define MAXCOLS 256 static double IN[MAXROWS][8]; static int N_INPUT = 0; static int EXPLEN[MAXROWS]; static const char *GDIR = NULL; static double parse_cell(const char *s) { if (strcmp(s, "nan") == 0) return NANV; if (strcmp(s, "inf") == 0) return INFINITY; if (strcmp(s, "-inf") == 0) return -INFINITY; return atof(s); } static int split_line(char *line, double *out, int max) { int n = 0; char *p = line; while (*p && n < max) { char *comma = strchr(p, ','); if (comma) *comma = '\0'; out[n++] = parse_cell(p); if (!comma) break; p = comma + 1; } return n; } static FILE *open_fixture(const char *name) { char path[1024]; snprintf(path, sizeof(path), "%s/%s.csv", GDIR, name); return fopen(path, "r"); } static void load_input(void) { FILE *f = open_fixture("input"); if (!f) { fprintf(stderr, "cannot open input.csv in %s\n", GDIR); exit(2); } char line[8192]; int first = 1; while (fgets(line, sizeof(line), f)) { line[strcspn(line, "\r\n")] = '\0'; if (first) { first = 0; continue; } if (line[0] == '\0') continue; N_INPUT += (split_line(line, IN[N_INPUT], 8) > 0); } fclose(f); } /* Read a fixture, keeping blank rows (a candle on which no bar closed). */ static int read_fixture(const char *name, double ***outp) { FILE *f = open_fixture(name); if (!f) { fprintf(stderr, "cannot open %s.csv\n", name); exit(2); } double **rows = (double **)malloc(sizeof(double *) * MAXROWS); int n = 0, first = 1; char line[8192]; while (fgets(line, sizeof(line), f) && n < MAXROWS) { line[strcspn(line, "\r\n")] = '\0'; if (first) { first = 0; continue; } double *vals = (double *)malloc(sizeof(double) * MAXCOLS); int c = (line[0] == '\0') ? 0 : split_line(line, vals, MAXCOLS); EXPLEN[n] = c; rows[n++] = vals; } fclose(f); *outp = rows; return n; } static void free_fixture(double **rows, int n) { for (int i = 0; i < n; i++) free(rows[i]); free(rows); } static int close_to(double g, double w) { if (isnan(w)) return isnan(g); if (isinf(w)) return isinf(g) && ((g > 0) == (w > 0)); double tol = 1e-6 * (fabs(w) > 1.0 ? fabs(w) : 1.0); return fabs(g - w) <= tol; } static int cmp_row(const char *name, int i, const double *want, int wn, const double *got, int gn) { if (wn != gn) { printf("FAIL %s row %d: arity %d vs %d\n", name, i, gn, wn); return 1; } for (int k = 0; k < wn; k++) { if (!close_to(got[k], want[k])) { printf("FAIL %s row %d col %d: got %g want %g\n", name, i, k, got[k], want[k]); return 1; } } return 0; } static int check_AbandonedBaby(void) { struct AbandonedBaby *h = wickra_abandoned_baby_new(); if (!h) { printf("FAIL AbandonedBaby: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AbandonedBaby", &exp); int fails = 0; { const char *nm = wickra_abandoned_baby_name(h); if (!nm || strcmp(nm, "AbandonedBaby") != 0) { printf("FAIL AbandonedBaby: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_abandoned_baby_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AbandonedBaby", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_abandoned_baby_free(h); return fails; } static int check_Abcd(void) { struct Abcd *h = wickra_abcd_new(); if (!h) { printf("FAIL Abcd: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Abcd", &exp); int fails = 0; { const char *nm = wickra_abcd_name(h); if (!nm || strcmp(nm, "Abcd") != 0) { printf("FAIL Abcd: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_abcd_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Abcd", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_abcd_free(h); return fails; } static int check_AbsoluteBreadthIndex(void) { struct AbsoluteBreadthIndex *h = wickra_absolute_breadth_index_new(); if (!h) { printf("FAIL AbsoluteBreadthIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AbsoluteBreadthIndex", &exp); int fails = 0; { const char *nm = wickra_absolute_breadth_index_name(h); if (!nm || strcmp(nm, "AbsoluteBreadthIndex") != 0) { printf("FAIL AbsoluteBreadthIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_absolute_breadth_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("AbsoluteBreadthIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_absolute_breadth_index_free(h); return fails; } static int check_AccelerationBands(void) { struct AccelerationBands *h = wickra_acceleration_bands_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL AccelerationBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AccelerationBands", &exp); int fails = 0; { const char *nm = wickra_acceleration_bands_name(h); if (!nm || strcmp(nm, "AccelerationBands") != 0) { printf("FAIL AccelerationBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAccelerationBandsOutput out; if (wickra_acceleration_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("AccelerationBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_acceleration_bands_free(h); return fails; } static int check_AcceleratorOscillator(void) { struct AcceleratorOscillator *h = wickra_accelerator_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL AcceleratorOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AcceleratorOscillator", &exp); int fails = 0; { const char *nm = wickra_accelerator_oscillator_name(h); if (!nm || strcmp(nm, "AcceleratorOscillator") != 0) { printf("FAIL AcceleratorOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_accelerator_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AcceleratorOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_accelerator_oscillator_free(h); return fails; } static int check_AdOscillator(void) { struct AdOscillator *h = wickra_ad_oscillator_new(); if (!h) { printf("FAIL AdOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdOscillator", &exp); int fails = 0; { const char *nm = wickra_ad_oscillator_name(h); if (!nm || strcmp(nm, "ADOSC") != 0) { printf("FAIL AdOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ad_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AdOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ad_oscillator_free(h); return fails; } static int check_AdVolumeLine(void) { struct AdVolumeLine *h = wickra_ad_volume_line_new(); if (!h) { printf("FAIL AdVolumeLine: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdVolumeLine", &exp); int fails = 0; { const char *nm = wickra_ad_volume_line_name(h); if (!nm || strcmp(nm, "AdVolumeLine") != 0) { printf("FAIL AdVolumeLine: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_ad_volume_line_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("AdVolumeLine", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ad_volume_line_free(h); return fails; } static int check_AdaptiveCci(void) { struct AdaptiveCci *h = wickra_adaptive_cci_new((uintptr_t)14); if (!h) { printf("FAIL AdaptiveCci: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdaptiveCci", &exp); int fails = 0; { const char *nm = wickra_adaptive_cci_name(h); if (!nm || strcmp(nm, "AdaptiveCci") != 0) { printf("FAIL AdaptiveCci: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_adaptive_cci_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AdaptiveCci", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adaptive_cci_free(h); return fails; } static int check_AdaptiveCycle(void) { struct AdaptiveCycle *h = wickra_adaptive_cycle_new(); if (!h) { printf("FAIL AdaptiveCycle: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdaptiveCycle", &exp); int fails = 0; { const char *nm = wickra_adaptive_cycle_name(h); if (!nm || strcmp(nm, "AdaptiveCycle") != 0) { printf("FAIL AdaptiveCycle: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_adaptive_cycle_update(h, c); fails += cmp_row("AdaptiveCycle", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adaptive_cycle_free(h); return fails; } static int check_AdaptiveLaguerreFilter(void) { struct AdaptiveLaguerreFilter *h = wickra_adaptive_laguerre_filter_new((uintptr_t)20); if (!h) { printf("FAIL AdaptiveLaguerreFilter: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdaptiveLaguerreFilter", &exp); int fails = 0; { const char *nm = wickra_adaptive_laguerre_filter_name(h); if (!nm || strcmp(nm, "AdaptiveLaguerre") != 0) { printf("FAIL AdaptiveLaguerreFilter: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_adaptive_laguerre_filter_update(h, c); fails += cmp_row("AdaptiveLaguerreFilter", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adaptive_laguerre_filter_free(h); return fails; } static int check_AdaptiveRsi(void) { struct AdaptiveRsi *h = wickra_adaptive_rsi_new((uintptr_t)14); if (!h) { printf("FAIL AdaptiveRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdaptiveRsi", &exp); int fails = 0; { const char *nm = wickra_adaptive_rsi_name(h); if (!nm || strcmp(nm, "AdaptiveRsi") != 0) { printf("FAIL AdaptiveRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_adaptive_rsi_update(h, c); fails += cmp_row("AdaptiveRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adaptive_rsi_free(h); return fails; } static int check_Adl(void) { struct Adl *h = wickra_adl_new(); if (!h) { printf("FAIL Adl: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Adl", &exp); int fails = 0; { const char *nm = wickra_adl_name(h); if (!nm || strcmp(nm, "ADL") != 0) { printf("FAIL Adl: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_adl_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Adl", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adl_free(h); return fails; } static int check_AdvanceBlock(void) { struct AdvanceBlock *h = wickra_advance_block_new(); if (!h) { printf("FAIL AdvanceBlock: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdvanceBlock", &exp); int fails = 0; { const char *nm = wickra_advance_block_name(h); if (!nm || strcmp(nm, "AdvanceBlock") != 0) { printf("FAIL AdvanceBlock: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_advance_block_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AdvanceBlock", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_advance_block_free(h); return fails; } static int check_AdvanceDecline(void) { struct AdvanceDecline *h = wickra_advance_decline_new(); if (!h) { printf("FAIL AdvanceDecline: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdvanceDecline", &exp); int fails = 0; { const char *nm = wickra_advance_decline_name(h); if (!nm || strcmp(nm, "AdvanceDecline") != 0) { printf("FAIL AdvanceDecline: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_advance_decline_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("AdvanceDecline", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_advance_decline_free(h); return fails; } static int check_AdvanceDeclineRatio(void) { struct AdvanceDeclineRatio *h = wickra_advance_decline_ratio_new(); if (!h) { printf("FAIL AdvanceDeclineRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AdvanceDeclineRatio", &exp); int fails = 0; { const char *nm = wickra_advance_decline_ratio_name(h); if (!nm || strcmp(nm, "AdvanceDeclineRatio") != 0) { printf("FAIL AdvanceDeclineRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_advance_decline_ratio_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("AdvanceDeclineRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_advance_decline_ratio_free(h); return fails; } static int check_Adx(void) { struct Adx *h = wickra_adx_new((uintptr_t)14); if (!h) { printf("FAIL Adx: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Adx", &exp); int fails = 0; { const char *nm = wickra_adx_name(h); if (!nm || strcmp(nm, "ADX") != 0) { printf("FAIL Adx: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAdxOutput out; if (wickra_adx_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.plus_di; got[gn++] = out.minus_di; got[gn++] = out.adx; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("Adx", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adx_free(h); return fails; } static int check_Adxr(void) { struct Adxr *h = wickra_adxr_new((uintptr_t)14); if (!h) { printf("FAIL Adxr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Adxr", &exp); int fails = 0; { const char *nm = wickra_adxr_name(h); if (!nm || strcmp(nm, "ADXR") != 0) { printf("FAIL Adxr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_adxr_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Adxr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_adxr_free(h); return fails; } static int check_Alligator(void) { struct Alligator *h = wickra_alligator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL Alligator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Alligator", &exp); int fails = 0; { const char *nm = wickra_alligator_name(h); if (!nm || strcmp(nm, "Alligator") != 0) { printf("FAIL Alligator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAlligatorOutput out; if (wickra_alligator_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.jaw; got[gn++] = out.teeth; got[gn++] = out.lips; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("Alligator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_alligator_free(h); return fails; } static int check_Alma(void) { struct Alma *h = wickra_alma_new((uintptr_t)9, 0.85, 6.0); if (!h) { printf("FAIL Alma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Alma", &exp); int fails = 0; { const char *nm = wickra_alma_name(h); if (!nm || strcmp(nm, "ALMA") != 0) { printf("FAIL Alma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_alma_update(h, c); fails += cmp_row("Alma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_alma_free(h); return fails; } static int check_Alpha(void) { struct Alpha *h = wickra_alpha_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL Alpha: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Alpha", &exp); int fails = 0; { const char *nm = wickra_alpha_name(h); if (!nm || strcmp(nm, "Alpha") != 0) { printf("FAIL Alpha: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_alpha_update(h, c, o); fails += cmp_row("Alpha", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_alpha_free(h); return fails; } static int check_AmihudIlliquidity(void) { struct AmihudIlliquidity *h = wickra_amihud_illiquidity_new((uintptr_t)20); if (!h) { printf("FAIL AmihudIlliquidity: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AmihudIlliquidity", &exp); int fails = 0; { const char *nm = wickra_amihud_illiquidity_name(h); if (!nm || strcmp(nm, "AmihudIlliquidity") != 0) { printf("FAIL AmihudIlliquidity: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_amihud_illiquidity_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("AmihudIlliquidity", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_amihud_illiquidity_free(h); return fails; } static int check_AnchoredRsi(void) { struct AnchoredRsi *h = wickra_anchored_rsi_new(); if (!h) { printf("FAIL AnchoredRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AnchoredRsi", &exp); int fails = 0; { const char *nm = wickra_anchored_rsi_name(h); if (!nm || strcmp(nm, "AnchoredRSI") != 0) { printf("FAIL AnchoredRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_anchored_rsi_update(h, c); fails += cmp_row("AnchoredRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_anchored_rsi_free(h); return fails; } static int check_AnchoredVwap(void) { struct AnchoredVwap *h = wickra_anchored_vwap_new(); if (!h) { printf("FAIL AnchoredVwap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AnchoredVwap", &exp); int fails = 0; { const char *nm = wickra_anchored_vwap_name(h); if (!nm || strcmp(nm, "AnchoredVWAP") != 0) { printf("FAIL AnchoredVwap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_anchored_vwap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AnchoredVwap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_anchored_vwap_free(h); return fails; } static int check_AndrewsPitchfork(void) { struct AndrewsPitchfork *h = wickra_andrews_pitchfork_new((uintptr_t)14); if (!h) { printf("FAIL AndrewsPitchfork: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AndrewsPitchfork", &exp); int fails = 0; { const char *nm = wickra_andrews_pitchfork_name(h); if (!nm || strcmp(nm, "AndrewsPitchfork") != 0) { printf("FAIL AndrewsPitchfork: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAndrewsPitchforkOutput out; if (wickra_andrews_pitchfork_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.median; got[gn++] = out.upper; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("AndrewsPitchfork", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_andrews_pitchfork_free(h); return fails; } static int check_Apo(void) { struct Apo *h = wickra_apo_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Apo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Apo", &exp); int fails = 0; { const char *nm = wickra_apo_name(h); if (!nm || strcmp(nm, "APO") != 0) { printf("FAIL Apo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_apo_update(h, c); fails += cmp_row("Apo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_apo_free(h); return fails; } static int check_Aroon(void) { struct Aroon *h = wickra_aroon_new((uintptr_t)14); if (!h) { printf("FAIL Aroon: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Aroon", &exp); int fails = 0; { const char *nm = wickra_aroon_name(h); if (!nm || strcmp(nm, "Aroon") != 0) { printf("FAIL Aroon: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAroonOutput out; if (wickra_aroon_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.up; got[gn++] = out.down; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Aroon", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_aroon_free(h); return fails; } static int check_AroonOscillator(void) { struct AroonOscillator *h = wickra_aroon_oscillator_new((uintptr_t)14); if (!h) { printf("FAIL AroonOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AroonOscillator", &exp); int fails = 0; { const char *nm = wickra_aroon_oscillator_name(h); if (!nm || strcmp(nm, "AroonOscillator") != 0) { printf("FAIL AroonOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_aroon_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AroonOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_aroon_oscillator_free(h); return fails; } static int check_Atr(void) { struct Atr *h = wickra_atr_new((uintptr_t)14); if (!h) { printf("FAIL Atr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Atr", &exp); int fails = 0; { const char *nm = wickra_atr_name(h); if (!nm || strcmp(nm, "ATR") != 0) { printf("FAIL Atr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_atr_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Atr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_atr_free(h); return fails; } static int check_AtrBands(void) { struct AtrBands *h = wickra_atr_bands_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL AtrBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AtrBands", &exp); int fails = 0; { const char *nm = wickra_atr_bands_name(h); if (!nm || strcmp(nm, "AtrBands") != 0) { printf("FAIL AtrBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAtrBandsOutput out; if (wickra_atr_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("AtrBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_atr_bands_free(h); return fails; } static int check_AtrRatchet(void) { struct AtrRatchet *h = wickra_atr_ratchet_new((uintptr_t)14, 2.0, 0.5); if (!h) { printf("FAIL AtrRatchet: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AtrRatchet", &exp); int fails = 0; { const char *nm = wickra_atr_ratchet_name(h); if (!nm || strcmp(nm, "AtrRatchet") != 0) { printf("FAIL AtrRatchet: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAtrRatchetOutput out; if (wickra_atr_ratchet_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.value; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("AtrRatchet", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_atr_ratchet_free(h); return fails; } static int check_AtrTrailingStop(void) { struct AtrTrailingStop *h = wickra_atr_trailing_stop_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL AtrTrailingStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AtrTrailingStop", &exp); int fails = 0; { const char *nm = wickra_atr_trailing_stop_name(h); if (!nm || strcmp(nm, "AtrTrailingStop") != 0) { printf("FAIL AtrTrailingStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_atr_trailing_stop_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AtrTrailingStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_atr_trailing_stop_free(h); return fails; } static int check_AutoFib(void) { struct AutoFib *h = wickra_auto_fib_new(); if (!h) { printf("FAIL AutoFib: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AutoFib", &exp); int fails = 0; { const char *nm = wickra_auto_fib_name(h); if (!nm || strcmp(nm, "AutoFib") != 0) { printf("FAIL AutoFib: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraAutoFibOutput out; if (wickra_auto_fib_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.level_0; got[gn++] = out.level_236; got[gn++] = out.level_382; got[gn++] = out.level_500; got[gn++] = out.level_618; got[gn++] = out.level_786; got[gn++] = out.level_1000; } else { for (int z = 0; z < 7; z++) got[gn++] = NANV; } fails += cmp_row("AutoFib", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_auto_fib_free(h); return fails; } static int check_Autocorrelation(void) { struct Autocorrelation *h = wickra_autocorrelation_new((uintptr_t)10, (uintptr_t)1); if (!h) { printf("FAIL Autocorrelation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Autocorrelation", &exp); int fails = 0; { const char *nm = wickra_autocorrelation_name(h); if (!nm || strcmp(nm, "Autocorrelation") != 0) { printf("FAIL Autocorrelation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_autocorrelation_update(h, c); fails += cmp_row("Autocorrelation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_autocorrelation_free(h); return fails; } static int check_AutocorrelationPeriodogram(void) { struct AutocorrelationPeriodogram *h = wickra_autocorrelation_periodogram_new((uintptr_t)10, (uintptr_t)48); if (!h) { printf("FAIL AutocorrelationPeriodogram: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AutocorrelationPeriodogram", &exp); int fails = 0; { const char *nm = wickra_autocorrelation_periodogram_name(h); if (!nm || strcmp(nm, "AutocorrelationPeriodogram") != 0) { printf("FAIL AutocorrelationPeriodogram: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_autocorrelation_periodogram_update(h, c); fails += cmp_row("AutocorrelationPeriodogram", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_autocorrelation_periodogram_free(h); return fails; } static int check_AverageDailyRange(void) { struct AverageDailyRange *h = wickra_average_daily_range_new((uintptr_t)14, (int32_t)0); if (!h) { printf("FAIL AverageDailyRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AverageDailyRange", &exp); int fails = 0; { const char *nm = wickra_average_daily_range_name(h); if (!nm || strcmp(nm, "AverageDailyRange") != 0) { printf("FAIL AverageDailyRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_average_daily_range_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AverageDailyRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_average_daily_range_free(h); return fails; } static int check_AverageDrawdown(void) { struct AverageDrawdown *h = wickra_average_drawdown_new((uintptr_t)14); if (!h) { printf("FAIL AverageDrawdown: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AverageDrawdown", &exp); int fails = 0; { const char *nm = wickra_average_drawdown_name(h); if (!nm || strcmp(nm, "AverageDrawdown") != 0) { printf("FAIL AverageDrawdown: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_average_drawdown_update(h, c); fails += cmp_row("AverageDrawdown", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_average_drawdown_free(h); return fails; } static int check_AvgPrice(void) { struct AvgPrice *h = wickra_avg_price_new(); if (!h) { printf("FAIL AvgPrice: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AvgPrice", &exp); int fails = 0; { const char *nm = wickra_avg_price_name(h); if (!nm || strcmp(nm, "AVGPRICE") != 0) { printf("FAIL AvgPrice: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_avg_price_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AvgPrice", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_avg_price_free(h); return fails; } static int check_AwesomeOscillator(void) { struct AwesomeOscillator *h = wickra_awesome_oscillator_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL AwesomeOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AwesomeOscillator", &exp); int fails = 0; { const char *nm = wickra_awesome_oscillator_name(h); if (!nm || strcmp(nm, "AwesomeOscillator") != 0) { printf("FAIL AwesomeOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_awesome_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AwesomeOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_awesome_oscillator_free(h); return fails; } static int check_AwesomeOscillatorHistogram(void) { struct AwesomeOscillatorHistogram *h = wickra_awesome_oscillator_histogram_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL AwesomeOscillatorHistogram: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_AwesomeOscillatorHistogram", &exp); int fails = 0; { const char *nm = wickra_awesome_oscillator_histogram_name(h); if (!nm || strcmp(nm, "AwesomeOscillatorHistogram") != 0) { printf("FAIL AwesomeOscillatorHistogram: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_awesome_oscillator_histogram_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("AwesomeOscillatorHistogram", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_awesome_oscillator_histogram_free(h); return fails; } static int check_BalanceOfPower(void) { struct BalanceOfPower *h = wickra_balance_of_power_new(); if (!h) { printf("FAIL BalanceOfPower: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BalanceOfPower", &exp); int fails = 0; { const char *nm = wickra_balance_of_power_name(h); if (!nm || strcmp(nm, "BalanceOfPower") != 0) { printf("FAIL BalanceOfPower: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_balance_of_power_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("BalanceOfPower", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_balance_of_power_free(h); return fails; } static int check_BandpassFilter(void) { struct BandpassFilter *h = wickra_bandpass_filter_new((uintptr_t)20, 0.3); if (!h) { printf("FAIL BandpassFilter: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BandpassFilter", &exp); int fails = 0; { const char *nm = wickra_bandpass_filter_name(h); if (!nm || strcmp(nm, "BandpassFilter") != 0) { printf("FAIL BandpassFilter: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_bandpass_filter_update(h, c); fails += cmp_row("BandpassFilter", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bandpass_filter_free(h); return fails; } static int check_Bat(void) { struct Bat *h = wickra_bat_new(); if (!h) { printf("FAIL Bat: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Bat", &exp); int fails = 0; { const char *nm = wickra_bat_name(h); if (!nm || strcmp(nm, "Bat") != 0) { printf("FAIL Bat: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_bat_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Bat", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bat_free(h); return fails; } static int check_BeltHold(void) { struct BeltHold *h = wickra_belt_hold_new(); if (!h) { printf("FAIL BeltHold: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BeltHold", &exp); int fails = 0; { const char *nm = wickra_belt_hold_name(h); if (!nm || strcmp(nm, "BeltHold") != 0) { printf("FAIL BeltHold: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_belt_hold_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("BeltHold", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_belt_hold_free(h); return fails; } static int check_Beta(void) { struct Beta *h = wickra_beta_new((uintptr_t)14); if (!h) { printf("FAIL Beta: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Beta", &exp); int fails = 0; { const char *nm = wickra_beta_name(h); if (!nm || strcmp(nm, "Beta") != 0) { printf("FAIL Beta: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_beta_update(h, c, o); fails += cmp_row("Beta", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_beta_free(h); return fails; } static int check_BetaNeutralSpread(void) { struct BetaNeutralSpread *h = wickra_beta_neutral_spread_new((uintptr_t)14); if (!h) { printf("FAIL BetaNeutralSpread: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BetaNeutralSpread", &exp); int fails = 0; { const char *nm = wickra_beta_neutral_spread_name(h); if (!nm || strcmp(nm, "BetaNeutralSpread") != 0) { printf("FAIL BetaNeutralSpread: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_beta_neutral_spread_update(h, c, o); fails += cmp_row("BetaNeutralSpread", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_beta_neutral_spread_free(h); return fails; } static int check_BetterVolume(void) { struct BetterVolume *h = wickra_better_volume_new((uintptr_t)14); if (!h) { printf("FAIL BetterVolume: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BetterVolume", &exp); int fails = 0; { const char *nm = wickra_better_volume_name(h); if (!nm || strcmp(nm, "BetterVolume") != 0) { printf("FAIL BetterVolume: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_better_volume_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("BetterVolume", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_better_volume_free(h); return fails; } static int check_BipowerVariation(void) { struct BipowerVariation *h = wickra_bipower_variation_new((uintptr_t)14); if (!h) { printf("FAIL BipowerVariation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BipowerVariation", &exp); int fails = 0; { const char *nm = wickra_bipower_variation_name(h); if (!nm || strcmp(nm, "BipowerVariation") != 0) { printf("FAIL BipowerVariation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_bipower_variation_update(h, c); fails += cmp_row("BipowerVariation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bipower_variation_free(h); return fails; } static int check_BodySizePct(void) { struct BodySizePct *h = wickra_body_size_pct_new(); if (!h) { printf("FAIL BodySizePct: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BodySizePct", &exp); int fails = 0; { const char *nm = wickra_body_size_pct_name(h); if (!nm || strcmp(nm, "BodySizePct") != 0) { printf("FAIL BodySizePct: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_body_size_pct_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("BodySizePct", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_body_size_pct_free(h); return fails; } static int check_BollingerBands(void) { struct BollingerBands *h = wickra_bollinger_bands_new((uintptr_t)20, 2.0); if (!h) { printf("FAIL BollingerBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BollingerBands", &exp); int fails = 0; { const char *nm = wickra_bollinger_bands_name(h); if (!nm || strcmp(nm, "BollingerBands") != 0) { printf("FAIL BollingerBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraBollingerOutput out; if (wickra_bollinger_bands_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; got[gn++] = out.stddev; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("BollingerBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bollinger_bands_free(h); return fails; } static int check_BollingerBandwidth(void) { struct BollingerBandwidth *h = wickra_bollinger_bandwidth_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL BollingerBandwidth: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BollingerBandwidth", &exp); int fails = 0; { const char *nm = wickra_bollinger_bandwidth_name(h); if (!nm || strcmp(nm, "BollingerBandwidth") != 0) { printf("FAIL BollingerBandwidth: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_bollinger_bandwidth_update(h, c); fails += cmp_row("BollingerBandwidth", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bollinger_bandwidth_free(h); return fails; } static int check_BomarBands(void) { struct BomarBands *h = wickra_bomar_bands_new((uintptr_t)4, 0.85); if (!h) { printf("FAIL BomarBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BomarBands", &exp); int fails = 0; { const char *nm = wickra_bomar_bands_name(h); if (!nm || strcmp(nm, "BomarBands") != 0) { printf("FAIL BomarBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraBomarBandsOutput out; if (wickra_bomar_bands_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("BomarBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bomar_bands_free(h); return fails; } static int check_BreadthThrust(void) { struct BreadthThrust *h = wickra_breadth_thrust_new((uintptr_t)10); if (!h) { printf("FAIL BreadthThrust: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BreadthThrust", &exp); int fails = 0; { const char *nm = wickra_breadth_thrust_name(h); if (!nm || strcmp(nm, "BreadthThrust") != 0) { printf("FAIL BreadthThrust: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_breadth_thrust_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("BreadthThrust", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_breadth_thrust_free(h); return fails; } static int check_Breakaway(void) { struct Breakaway *h = wickra_breakaway_new(); if (!h) { printf("FAIL Breakaway: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Breakaway", &exp); int fails = 0; { const char *nm = wickra_breakaway_name(h); if (!nm || strcmp(nm, "Breakaway") != 0) { printf("FAIL Breakaway: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_breakaway_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Breakaway", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_breakaway_free(h); return fails; } static int check_BullishPercentIndex(void) { struct BullishPercentIndex *h = wickra_bullish_percent_index_new(); if (!h) { printf("FAIL BullishPercentIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BullishPercentIndex", &exp); int fails = 0; { const char *nm = wickra_bullish_percent_index_name(h); if (!nm || strcmp(nm, "BullishPercentIndex") != 0) { printf("FAIL BullishPercentIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_bullish_percent_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("BullishPercentIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_bullish_percent_index_free(h); return fails; } static int check_BurkeRatio(void) { struct BurkeRatio *h = wickra_burke_ratio_new((uintptr_t)14); if (!h) { printf("FAIL BurkeRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_BurkeRatio", &exp); int fails = 0; { const char *nm = wickra_burke_ratio_name(h); if (!nm || strcmp(nm, "BurkeRatio") != 0) { printf("FAIL BurkeRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_burke_ratio_update(h, c); fails += cmp_row("BurkeRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_burke_ratio_free(h); return fails; } static int check_Butterfly(void) { struct Butterfly *h = wickra_butterfly_new(); if (!h) { printf("FAIL Butterfly: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Butterfly", &exp); int fails = 0; { const char *nm = wickra_butterfly_name(h); if (!nm || strcmp(nm, "Butterfly") != 0) { printf("FAIL Butterfly: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_butterfly_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Butterfly", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_butterfly_free(h); return fails; } static int check_CalendarSpread(void) { struct CalendarSpread *h = wickra_calendar_spread_new(); if (!h) { printf("FAIL CalendarSpread: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CalendarSpread", &exp); int fails = 0; { const char *nm = wickra_calendar_spread_name(h); if (!nm || strcmp(nm, "CalendarSpread") != 0) { printf("FAIL CalendarSpread: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_calendar_spread_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("CalendarSpread", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_calendar_spread_free(h); return fails; } static int check_CalmarRatio(void) { struct CalmarRatio *h = wickra_calmar_ratio_new((uintptr_t)14); if (!h) { printf("FAIL CalmarRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CalmarRatio", &exp); int fails = 0; { const char *nm = wickra_calmar_ratio_name(h); if (!nm || strcmp(nm, "CalmarRatio") != 0) { printf("FAIL CalmarRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_calmar_ratio_update(h, c); fails += cmp_row("CalmarRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_calmar_ratio_free(h); return fails; } static int check_Camarilla(void) { struct Camarilla *h = wickra_camarilla_new(); if (!h) { printf("FAIL Camarilla: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Camarilla", &exp); int fails = 0; { const char *nm = wickra_camarilla_name(h); if (!nm || strcmp(nm, "Camarilla") != 0) { printf("FAIL Camarilla: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraCamarillaPivotsOutput out; if (wickra_camarilla_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.pp; got[gn++] = out.r1; got[gn++] = out.r2; got[gn++] = out.r3; got[gn++] = out.r4; got[gn++] = out.s1; got[gn++] = out.s2; got[gn++] = out.s3; got[gn++] = out.s4; } else { for (int z = 0; z < 9; z++) got[gn++] = NANV; } fails += cmp_row("Camarilla", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_camarilla_free(h); return fails; } static int check_CandleVolume(void) { struct CandleVolume *h = wickra_candle_volume_new((uintptr_t)14); if (!h) { printf("FAIL CandleVolume: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CandleVolume", &exp); int fails = 0; { const char *nm = wickra_candle_volume_name(h); if (!nm || strcmp(nm, "CandleVolume") != 0) { printf("FAIL CandleVolume: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraCandleVolumeOutput out; if (wickra_candle_volume_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.body; got[gn++] = out.width; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("CandleVolume", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_candle_volume_free(h); return fails; } static int check_Cci(void) { struct Cci *h = wickra_cci_new((uintptr_t)14); if (!h) { printf("FAIL Cci: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Cci", &exp); int fails = 0; { const char *nm = wickra_cci_name(h); if (!nm || strcmp(nm, "CCI") != 0) { printf("FAIL Cci: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cci_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Cci", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cci_free(h); return fails; } static int check_CenterOfGravity(void) { struct CenterOfGravity *h = wickra_center_of_gravity_new((uintptr_t)14); if (!h) { printf("FAIL CenterOfGravity: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CenterOfGravity", &exp); int fails = 0; { const char *nm = wickra_center_of_gravity_name(h); if (!nm || strcmp(nm, "CenterOfGravity") != 0) { printf("FAIL CenterOfGravity: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_center_of_gravity_update(h, c); fails += cmp_row("CenterOfGravity", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_center_of_gravity_free(h); return fails; } static int check_CentralPivotRange(void) { struct CentralPivotRange *h = wickra_central_pivot_range_new(); if (!h) { printf("FAIL CentralPivotRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CentralPivotRange", &exp); int fails = 0; { const char *nm = wickra_central_pivot_range_name(h); if (!nm || strcmp(nm, "CentralPivotRange") != 0) { printf("FAIL CentralPivotRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraCentralPivotRangeOutput out; if (wickra_central_pivot_range_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.pivot; got[gn++] = out.tc; got[gn++] = out.bc; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("CentralPivotRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_central_pivot_range_free(h); return fails; } static int check_Cfo(void) { struct Cfo *h = wickra_cfo_new((uintptr_t)14); if (!h) { printf("FAIL Cfo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Cfo", &exp); int fails = 0; { const char *nm = wickra_cfo_name(h); if (!nm || strcmp(nm, "CFO") != 0) { printf("FAIL Cfo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cfo_update(h, c); fails += cmp_row("Cfo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cfo_free(h); return fails; } static int check_ChaikinMoneyFlow(void) { struct ChaikinMoneyFlow *h = wickra_chaikin_money_flow_new((uintptr_t)20); if (!h) { printf("FAIL ChaikinMoneyFlow: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ChaikinMoneyFlow", &exp); int fails = 0; { const char *nm = wickra_chaikin_money_flow_name(h); if (!nm || strcmp(nm, "CMF") != 0) { printf("FAIL ChaikinMoneyFlow: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_chaikin_money_flow_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ChaikinMoneyFlow", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_chaikin_money_flow_free(h); return fails; } static int check_ChaikinOscillator(void) { struct ChaikinOscillator *h = wickra_chaikin_oscillator_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL ChaikinOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ChaikinOscillator", &exp); int fails = 0; { const char *nm = wickra_chaikin_oscillator_name(h); if (!nm || strcmp(nm, "ChaikinOscillator") != 0) { printf("FAIL ChaikinOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_chaikin_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ChaikinOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_chaikin_oscillator_free(h); return fails; } static int check_ChaikinVolatility(void) { struct ChaikinVolatility *h = wickra_chaikin_volatility_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL ChaikinVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ChaikinVolatility", &exp); int fails = 0; { const char *nm = wickra_chaikin_volatility_name(h); if (!nm || strcmp(nm, "ChaikinVolatility") != 0) { printf("FAIL ChaikinVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_chaikin_volatility_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ChaikinVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_chaikin_volatility_free(h); return fails; } static int check_ChandeKrollStop(void) { struct ChandeKrollStop *h = wickra_chande_kroll_stop_new((uintptr_t)3, 2.0, (uintptr_t)7); if (!h) { printf("FAIL ChandeKrollStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ChandeKrollStop", &exp); int fails = 0; { const char *nm = wickra_chande_kroll_stop_name(h); if (!nm || strcmp(nm, "ChandeKrollStop") != 0) { printf("FAIL ChandeKrollStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraChandeKrollStopOutput out; if (wickra_chande_kroll_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.stop_long; got[gn++] = out.stop_short; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("ChandeKrollStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_chande_kroll_stop_free(h); return fails; } static int check_ChandelierExit(void) { struct ChandelierExit *h = wickra_chandelier_exit_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL ChandelierExit: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ChandelierExit", &exp); int fails = 0; { const char *nm = wickra_chandelier_exit_name(h); if (!nm || strcmp(nm, "ChandelierExit") != 0) { printf("FAIL ChandelierExit: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraChandelierExitOutput out; if (wickra_chandelier_exit_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.long_stop; got[gn++] = out.short_stop; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("ChandelierExit", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_chandelier_exit_free(h); return fails; } static int check_ChoppinessIndex(void) { struct ChoppinessIndex *h = wickra_choppiness_index_new((uintptr_t)14); if (!h) { printf("FAIL ChoppinessIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ChoppinessIndex", &exp); int fails = 0; { const char *nm = wickra_choppiness_index_name(h); if (!nm || strcmp(nm, "ChoppinessIndex") != 0) { printf("FAIL ChoppinessIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_choppiness_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ChoppinessIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_choppiness_index_free(h); return fails; } static int check_ClassicPivots(void) { struct ClassicPivots *h = wickra_classic_pivots_new(); if (!h) { printf("FAIL ClassicPivots: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ClassicPivots", &exp); int fails = 0; { const char *nm = wickra_classic_pivots_name(h); if (!nm || strcmp(nm, "ClassicPivots") != 0) { printf("FAIL ClassicPivots: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraClassicPivotsOutput out; if (wickra_classic_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.pp; got[gn++] = out.r1; got[gn++] = out.r2; got[gn++] = out.r3; got[gn++] = out.s1; got[gn++] = out.s2; got[gn++] = out.s3; } else { for (int z = 0; z < 7; z++) got[gn++] = NANV; } fails += cmp_row("ClassicPivots", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_classic_pivots_free(h); return fails; } static int check_CloseVsOpen(void) { struct CloseVsOpen *h = wickra_close_vs_open_new(); if (!h) { printf("FAIL CloseVsOpen: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CloseVsOpen", &exp); int fails = 0; { const char *nm = wickra_close_vs_open_name(h); if (!nm || strcmp(nm, "CloseVsOpen") != 0) { printf("FAIL CloseVsOpen: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_close_vs_open_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("CloseVsOpen", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_close_vs_open_free(h); return fails; } static int check_ClosingMarubozu(void) { struct ClosingMarubozu *h = wickra_closing_marubozu_new(); if (!h) { printf("FAIL ClosingMarubozu: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ClosingMarubozu", &exp); int fails = 0; { const char *nm = wickra_closing_marubozu_name(h); if (!nm || strcmp(nm, "ClosingMarubozu") != 0) { printf("FAIL ClosingMarubozu: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_closing_marubozu_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ClosingMarubozu", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_closing_marubozu_free(h); return fails; } static int check_Cmo(void) { struct Cmo *h = wickra_cmo_new((uintptr_t)14); if (!h) { printf("FAIL Cmo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Cmo", &exp); int fails = 0; { const char *nm = wickra_cmo_name(h); if (!nm || strcmp(nm, "CMO") != 0) { printf("FAIL Cmo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cmo_update(h, c); fails += cmp_row("Cmo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cmo_free(h); return fails; } static int check_CoefficientOfVariation(void) { struct CoefficientOfVariation *h = wickra_coefficient_of_variation_new((uintptr_t)14); if (!h) { printf("FAIL CoefficientOfVariation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CoefficientOfVariation", &exp); int fails = 0; { const char *nm = wickra_coefficient_of_variation_name(h); if (!nm || strcmp(nm, "CoefficientOfVariation") != 0) { printf("FAIL CoefficientOfVariation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_coefficient_of_variation_update(h, c); fails += cmp_row("CoefficientOfVariation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_coefficient_of_variation_free(h); return fails; } static int check_Cointegration(void) { struct Cointegration *h = wickra_cointegration_new((uintptr_t)40, (uintptr_t)1); if (!h) { printf("FAIL Cointegration: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Cointegration", &exp); int fails = 0; { const char *nm = wickra_cointegration_name(h); if (!nm || strcmp(nm, "Cointegration") != 0) { printf("FAIL Cointegration: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraCointegrationOutput out; if (wickra_cointegration_update(h, c, o, &out)) { got[gn++] = out.hedge_ratio; got[gn++] = out.spread; got[gn++] = out.adf_stat; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("Cointegration", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cointegration_free(h); return fails; } static int check_CommonSenseRatio(void) { struct CommonSenseRatio *h = wickra_common_sense_ratio_new((uintptr_t)14); if (!h) { printf("FAIL CommonSenseRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CommonSenseRatio", &exp); int fails = 0; { const char *nm = wickra_common_sense_ratio_name(h); if (!nm || strcmp(nm, "CommonSenseRatio") != 0) { printf("FAIL CommonSenseRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_common_sense_ratio_update(h, c); fails += cmp_row("CommonSenseRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_common_sense_ratio_free(h); return fails; } static int check_CompositeProfile(void) { struct CompositeProfile *h = wickra_composite_profile_new((uintptr_t)20, (uintptr_t)24, 0.7); if (!h) { printf("FAIL CompositeProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CompositeProfile", &exp); int fails = 0; { const char *nm = wickra_composite_profile_name(h); if (!nm || strcmp(nm, "CompositeProfile") != 0) { printf("FAIL CompositeProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraCompositeProfileOutput out; if (wickra_composite_profile_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.poc; got[gn++] = out.vah; got[gn++] = out.val; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("CompositeProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_composite_profile_free(h); return fails; } static int check_ConcealingBabySwallow(void) { struct ConcealingBabySwallow *h = wickra_concealing_baby_swallow_new(); if (!h) { printf("FAIL ConcealingBabySwallow: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ConcealingBabySwallow", &exp); int fails = 0; { const char *nm = wickra_concealing_baby_swallow_name(h); if (!nm || strcmp(nm, "ConcealingBabySwallow") != 0) { printf("FAIL ConcealingBabySwallow: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_concealing_baby_swallow_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ConcealingBabySwallow", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_concealing_baby_swallow_free(h); return fails; } static int check_ConditionalValueAtRisk(void) { struct ConditionalValueAtRisk *h = wickra_conditional_value_at_risk_new((uintptr_t)20, 0.95); if (!h) { printf("FAIL ConditionalValueAtRisk: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ConditionalValueAtRisk", &exp); int fails = 0; { const char *nm = wickra_conditional_value_at_risk_name(h); if (!nm || strcmp(nm, "ConditionalValueAtRisk") != 0) { printf("FAIL ConditionalValueAtRisk: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_conditional_value_at_risk_update(h, c); fails += cmp_row("ConditionalValueAtRisk", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_conditional_value_at_risk_free(h); return fails; } static int check_ConnorsRsi(void) { struct ConnorsRsi *h = wickra_connors_rsi_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL ConnorsRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ConnorsRsi", &exp); int fails = 0; { const char *nm = wickra_connors_rsi_name(h); if (!nm || strcmp(nm, "ConnorsRSI") != 0) { printf("FAIL ConnorsRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_connors_rsi_update(h, c); fails += cmp_row("ConnorsRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_connors_rsi_free(h); return fails; } static int check_Coppock(void) { struct Coppock *h = wickra_coppock_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL Coppock: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Coppock", &exp); int fails = 0; { const char *nm = wickra_coppock_name(h); if (!nm || strcmp(nm, "Coppock") != 0) { printf("FAIL Coppock: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_coppock_update(h, c); fails += cmp_row("Coppock", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_coppock_free(h); return fails; } static int check_CorrelationTrendIndicator(void) { struct CorrelationTrendIndicator *h = wickra_correlation_trend_indicator_new((uintptr_t)14); if (!h) { printf("FAIL CorrelationTrendIndicator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CorrelationTrendIndicator", &exp); int fails = 0; { const char *nm = wickra_correlation_trend_indicator_name(h); if (!nm || strcmp(nm, "CorrelationTrendIndicator") != 0) { printf("FAIL CorrelationTrendIndicator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_correlation_trend_indicator_update(h, c); fails += cmp_row("CorrelationTrendIndicator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_correlation_trend_indicator_free(h); return fails; } static int check_Counterattack(void) { struct Counterattack *h = wickra_counterattack_new(); if (!h) { printf("FAIL Counterattack: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Counterattack", &exp); int fails = 0; { const char *nm = wickra_counterattack_name(h); if (!nm || strcmp(nm, "Counterattack") != 0) { printf("FAIL Counterattack: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_counterattack_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Counterattack", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_counterattack_free(h); return fails; } static int check_Crab(void) { struct Crab *h = wickra_crab_new(); if (!h) { printf("FAIL Crab: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Crab", &exp); int fails = 0; { const char *nm = wickra_crab_name(h); if (!nm || strcmp(nm, "Crab") != 0) { printf("FAIL Crab: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_crab_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Crab", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_crab_free(h); return fails; } static int check_CumulativeVolumeDelta(void) { struct CumulativeVolumeDelta *h = wickra_cumulative_volume_delta_new(); if (!h) { printf("FAIL CumulativeVolumeDelta: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CumulativeVolumeDelta", &exp); int fails = 0; { const char *nm = wickra_cumulative_volume_delta_name(h); if (!nm || strcmp(nm, "CumulativeVolumeDelta") != 0) { printf("FAIL CumulativeVolumeDelta: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cumulative_volume_delta_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("CumulativeVolumeDelta", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cumulative_volume_delta_free(h); return fails; } static int check_CumulativeVolumeIndex(void) { struct CumulativeVolumeIndex *h = wickra_cumulative_volume_index_new(); if (!h) { printf("FAIL CumulativeVolumeIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CumulativeVolumeIndex", &exp); int fails = 0; { const char *nm = wickra_cumulative_volume_index_name(h); if (!nm || strcmp(nm, "CumulativeVolumeIndex") != 0) { printf("FAIL CumulativeVolumeIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_cumulative_volume_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("CumulativeVolumeIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cumulative_volume_index_free(h); return fails; } static int check_CupAndHandle(void) { struct CupAndHandle *h = wickra_cup_and_handle_new(); if (!h) { printf("FAIL CupAndHandle: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CupAndHandle", &exp); int fails = 0; { const char *nm = wickra_cup_and_handle_name(h); if (!nm || strcmp(nm, "CupAndHandle") != 0) { printf("FAIL CupAndHandle: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cup_and_handle_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("CupAndHandle", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cup_and_handle_free(h); return fails; } static int check_CyberneticCycle(void) { struct CyberneticCycle *h = wickra_cybernetic_cycle_new((uintptr_t)14); if (!h) { printf("FAIL CyberneticCycle: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_CyberneticCycle", &exp); int fails = 0; { const char *nm = wickra_cybernetic_cycle_name(h); if (!nm || strcmp(nm, "CyberneticCycle") != 0) { printf("FAIL CyberneticCycle: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cybernetic_cycle_update(h, c); fails += cmp_row("CyberneticCycle", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cybernetic_cycle_free(h); return fails; } static int check_Cypher(void) { struct Cypher *h = wickra_cypher_new(); if (!h) { printf("FAIL Cypher: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Cypher", &exp); int fails = 0; { const char *nm = wickra_cypher_name(h); if (!nm || strcmp(nm, "Cypher") != 0) { printf("FAIL Cypher: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_cypher_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Cypher", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_cypher_free(h); return fails; } static int check_DayOfWeekProfile(void) { struct DayOfWeekProfile *h = wickra_day_of_week_profile_new((int32_t)0); if (!h) { printf("FAIL DayOfWeekProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DayOfWeekProfile", &exp); int fails = 0; { const char *nm = wickra_day_of_week_profile_name(h); if (!nm || strcmp(nm, "DayOfWeekProfile") != 0) { printf("FAIL DayOfWeekProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double vbuf[256]; intptr_t k = wickra_day_of_week_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256); if (k < 0) { for (int z = 0; z < 7; z++) got[gn++] = NANV; } else { for (int z = 0; z < 7; z++) got[gn++] = vbuf[z]; } fails += cmp_row("DayOfWeekProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_day_of_week_profile_free(h); return fails; } static int check_Decycler(void) { struct Decycler *h = wickra_decycler_new((uintptr_t)14); if (!h) { printf("FAIL Decycler: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Decycler", &exp); int fails = 0; { const char *nm = wickra_decycler_name(h); if (!nm || strcmp(nm, "Decycler") != 0) { printf("FAIL Decycler: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_decycler_update(h, c); fails += cmp_row("Decycler", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_decycler_free(h); return fails; } static int check_DecyclerOscillator(void) { struct DecyclerOscillator *h = wickra_decycler_oscillator_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL DecyclerOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DecyclerOscillator", &exp); int fails = 0; { const char *nm = wickra_decycler_oscillator_name(h); if (!nm || strcmp(nm, "DecyclerOscillator") != 0) { printf("FAIL DecyclerOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_decycler_oscillator_update(h, c); fails += cmp_row("DecyclerOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_decycler_oscillator_free(h); return fails; } static int check_Dema(void) { struct Dema *h = wickra_dema_new((uintptr_t)14); if (!h) { printf("FAIL Dema: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Dema", &exp); int fails = 0; { const char *nm = wickra_dema_name(h); if (!nm || strcmp(nm, "DEMA") != 0) { printf("FAIL Dema: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_dema_update(h, c); fails += cmp_row("Dema", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dema_free(h); return fails; } static int check_DemandIndex(void) { struct DemandIndex *h = wickra_demand_index_new((uintptr_t)14); if (!h) { printf("FAIL DemandIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DemandIndex", &exp); int fails = 0; { const char *nm = wickra_demand_index_name(h); if (!nm || strcmp(nm, "DemandIndex") != 0) { printf("FAIL DemandIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_demand_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("DemandIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_demand_index_free(h); return fails; } static int check_DemarkPivots(void) { struct DemarkPivots *h = wickra_demark_pivots_new(); if (!h) { printf("FAIL DemarkPivots: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DemarkPivots", &exp); int fails = 0; { const char *nm = wickra_demark_pivots_name(h); if (!nm || strcmp(nm, "DemarkPivots") != 0) { printf("FAIL DemarkPivots: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraDemarkPivotsOutput out; if (wickra_demark_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.pp; got[gn++] = out.r1; got[gn++] = out.s1; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("DemarkPivots", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_demark_pivots_free(h); return fails; } static int check_DepthSlope(void) { struct DepthSlope *h = wickra_depth_slope_new(); if (!h) { printf("FAIL DepthSlope: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DepthSlope", &exp); int fails = 0; { const char *nm = wickra_depth_slope_name(h); if (!nm || strcmp(nm, "DepthSlope") != 0) { printf("FAIL DepthSlope: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_depth_slope_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("DepthSlope", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_depth_slope_free(h); return fails; } static int check_DerivativeOscillator(void) { struct DerivativeOscillator *h = wickra_derivative_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28); if (!h) { printf("FAIL DerivativeOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DerivativeOscillator", &exp); int fails = 0; { const char *nm = wickra_derivative_oscillator_name(h); if (!nm || strcmp(nm, "DerivativeOscillator") != 0) { printf("FAIL DerivativeOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_derivative_oscillator_update(h, c); fails += cmp_row("DerivativeOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_derivative_oscillator_free(h); return fails; } static int check_DetrendedStdDev(void) { struct DetrendedStdDev *h = wickra_detrended_std_dev_new((uintptr_t)14); if (!h) { printf("FAIL DetrendedStdDev: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DetrendedStdDev", &exp); int fails = 0; { const char *nm = wickra_detrended_std_dev_name(h); if (!nm || strcmp(nm, "DetrendedStdDev") != 0) { printf("FAIL DetrendedStdDev: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_detrended_std_dev_update(h, c); fails += cmp_row("DetrendedStdDev", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_detrended_std_dev_free(h); return fails; } static int check_DisparityIndex(void) { struct DisparityIndex *h = wickra_disparity_index_new((uintptr_t)14); if (!h) { printf("FAIL DisparityIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DisparityIndex", &exp); int fails = 0; { const char *nm = wickra_disparity_index_name(h); if (!nm || strcmp(nm, "DisparityIndex") != 0) { printf("FAIL DisparityIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_disparity_index_update(h, c); fails += cmp_row("DisparityIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_disparity_index_free(h); return fails; } static int check_DistanceSsd(void) { struct DistanceSsd *h = wickra_distance_ssd_new((uintptr_t)14); if (!h) { printf("FAIL DistanceSsd: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DistanceSsd", &exp); int fails = 0; { const char *nm = wickra_distance_ssd_name(h); if (!nm || strcmp(nm, "DistanceSsd") != 0) { printf("FAIL DistanceSsd: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_distance_ssd_update(h, c, o); fails += cmp_row("DistanceSsd", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_distance_ssd_free(h); return fails; } static int check_Doji(void) { struct Doji *h = wickra_doji_new(); if (!h) { printf("FAIL Doji: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Doji", &exp); int fails = 0; { const char *nm = wickra_doji_name(h); if (!nm || strcmp(nm, "Doji") != 0) { printf("FAIL Doji: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_doji_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Doji", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_doji_free(h); return fails; } static int check_DojiStar(void) { struct DojiStar *h = wickra_doji_star_new(); if (!h) { printf("FAIL DojiStar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DojiStar", &exp); int fails = 0; { const char *nm = wickra_doji_star_name(h); if (!nm || strcmp(nm, "DojiStar") != 0) { printf("FAIL DojiStar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_doji_star_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("DojiStar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_doji_star_free(h); return fails; } static int check_DollarBars(void) { struct DollarBars *h = wickra_dollar_bars_new(50000.0); if (!h) { printf("FAIL DollarBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DollarBars", &exp); int fails = 0; { const char *nm = wickra_dollar_bars_name(h); if (!nm || strcmp(nm, "DollarBars") != 0) { printf("FAIL DollarBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraDollarBar bbuf[256]; uintptr_t k = wickra_dollar_bars_update(h, o, hi, lo, c, v, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].high; got[gn++] = (double)bbuf[b].low; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].volume; got[gn++] = (double)bbuf[b].dollar; } fails += cmp_row("DollarBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dollar_bars_free(h); return fails; } static int check_Donchian(void) { struct Donchian *h = wickra_donchian_new((uintptr_t)14); if (!h) { printf("FAIL Donchian: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Donchian", &exp); int fails = 0; { const char *nm = wickra_donchian_name(h); if (!nm || strcmp(nm, "DonchianChannels") != 0) { printf("FAIL Donchian: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraDonchianOutput out; if (wickra_donchian_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("Donchian", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_donchian_free(h); return fails; } static int check_DonchianStop(void) { struct DonchianStop *h = wickra_donchian_stop_new((uintptr_t)14); if (!h) { printf("FAIL DonchianStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DonchianStop", &exp); int fails = 0; { const char *nm = wickra_donchian_stop_name(h); if (!nm || strcmp(nm, "DonchianStop") != 0) { printf("FAIL DonchianStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraDonchianStopOutput out; if (wickra_donchian_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.stop_long; got[gn++] = out.stop_short; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("DonchianStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_donchian_stop_free(h); return fails; } static int check_DoubleBollinger(void) { struct DoubleBollinger *h = wickra_double_bollinger_new((uintptr_t)20, 1.0, 2.0); if (!h) { printf("FAIL DoubleBollinger: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DoubleBollinger", &exp); int fails = 0; { const char *nm = wickra_double_bollinger_name(h); if (!nm || strcmp(nm, "DoubleBollinger") != 0) { printf("FAIL DoubleBollinger: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraDoubleBollingerOutput out; if (wickra_double_bollinger_update(h, c, &out)) { got[gn++] = out.upper_outer; got[gn++] = out.upper_inner; got[gn++] = out.middle; got[gn++] = out.lower_inner; got[gn++] = out.lower_outer; } else { for (int z = 0; z < 5; z++) got[gn++] = NANV; } fails += cmp_row("DoubleBollinger", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_double_bollinger_free(h); return fails; } static int check_DoubleTopBottom(void) { struct DoubleTopBottom *h = wickra_double_top_bottom_new(); if (!h) { printf("FAIL DoubleTopBottom: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DoubleTopBottom", &exp); int fails = 0; { const char *nm = wickra_double_top_bottom_name(h); if (!nm || strcmp(nm, "DoubleTopBottom") != 0) { printf("FAIL DoubleTopBottom: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_double_top_bottom_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("DoubleTopBottom", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_double_top_bottom_free(h); return fails; } static int check_DownsideGapThreeMethods(void) { struct DownsideGapThreeMethods *h = wickra_downside_gap_three_methods_new(); if (!h) { printf("FAIL DownsideGapThreeMethods: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DownsideGapThreeMethods", &exp); int fails = 0; { const char *nm = wickra_downside_gap_three_methods_name(h); if (!nm || strcmp(nm, "DownsideGapThreeMethods") != 0) { printf("FAIL DownsideGapThreeMethods: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_downside_gap_three_methods_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("DownsideGapThreeMethods", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_downside_gap_three_methods_free(h); return fails; } static int check_Dpo(void) { struct Dpo *h = wickra_dpo_new((uintptr_t)14); if (!h) { printf("FAIL Dpo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Dpo", &exp); int fails = 0; { const char *nm = wickra_dpo_name(h); if (!nm || strcmp(nm, "DPO") != 0) { printf("FAIL Dpo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_dpo_update(h, c); fails += cmp_row("Dpo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dpo_free(h); return fails; } static int check_DragonflyDoji(void) { struct DragonflyDoji *h = wickra_dragonfly_doji_new(); if (!h) { printf("FAIL DragonflyDoji: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DragonflyDoji", &exp); int fails = 0; { const char *nm = wickra_dragonfly_doji_name(h); if (!nm || strcmp(nm, "DragonflyDoji") != 0) { printf("FAIL DragonflyDoji: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_dragonfly_doji_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("DragonflyDoji", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dragonfly_doji_free(h); return fails; } static int check_DrawdownDuration(void) { struct DrawdownDuration *h = wickra_drawdown_duration_new(); if (!h) { printf("FAIL DrawdownDuration: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DrawdownDuration", &exp); int fails = 0; { const char *nm = wickra_drawdown_duration_name(h); if (!nm || strcmp(nm, "DrawdownDuration") != 0) { printf("FAIL DrawdownDuration: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_drawdown_duration_update(h, c); fails += cmp_row("DrawdownDuration", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_drawdown_duration_free(h); return fails; } static int check_DumplingTop(void) { struct DumplingTop *h = wickra_dumpling_top_new((uintptr_t)14); if (!h) { printf("FAIL DumplingTop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DumplingTop", &exp); int fails = 0; { const char *nm = wickra_dumpling_top_name(h); if (!nm || strcmp(nm, "DumplingTop") != 0) { printf("FAIL DumplingTop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_dumpling_top_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("DumplingTop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dumpling_top_free(h); return fails; } static int check_Dx(void) { struct Dx *h = wickra_dx_new((uintptr_t)14); if (!h) { printf("FAIL Dx: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Dx", &exp); int fails = 0; { const char *nm = wickra_dx_name(h); if (!nm || strcmp(nm, "DX") != 0) { printf("FAIL Dx: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_dx_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Dx", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dx_free(h); return fails; } static int check_DynamicMomentumIndex(void) { struct DynamicMomentumIndex *h = wickra_dynamic_momentum_index_new((uintptr_t)14); if (!h) { printf("FAIL DynamicMomentumIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_DynamicMomentumIndex", &exp); int fails = 0; { const char *nm = wickra_dynamic_momentum_index_name(h); if (!nm || strcmp(nm, "DynamicMomentumIndex") != 0) { printf("FAIL DynamicMomentumIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_dynamic_momentum_index_update(h, c); fails += cmp_row("DynamicMomentumIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_dynamic_momentum_index_free(h); return fails; } static int check_EaseOfMovement(void) { struct EaseOfMovement *h = wickra_ease_of_movement_new((uintptr_t)14); if (!h) { printf("FAIL EaseOfMovement: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EaseOfMovement", &exp); int fails = 0; { const char *nm = wickra_ease_of_movement_name(h); if (!nm || strcmp(nm, "EaseOfMovement") != 0) { printf("FAIL EaseOfMovement: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ease_of_movement_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("EaseOfMovement", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ease_of_movement_free(h); return fails; } static int check_EffectiveSpread(void) { struct EffectiveSpread *h = wickra_effective_spread_new(); if (!h) { printf("FAIL EffectiveSpread: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EffectiveSpread", &exp); int fails = 0; { const char *nm = wickra_effective_spread_name(h); if (!nm || strcmp(nm, "EffectiveSpread") != 0) { printf("FAIL EffectiveSpread: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_effective_spread_update(h, c, v, c >= o, (int64_t)i, (hi + lo) / 2.0); fails += cmp_row("EffectiveSpread", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_effective_spread_free(h); return fails; } static int check_EhlersStochastic(void) { struct EhlersStochastic *h = wickra_ehlers_stochastic_new((uintptr_t)14); if (!h) { printf("FAIL EhlersStochastic: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EhlersStochastic", &exp); int fails = 0; { const char *nm = wickra_ehlers_stochastic_name(h); if (!nm || strcmp(nm, "EhlersStochastic") != 0) { printf("FAIL EhlersStochastic: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ehlers_stochastic_update(h, c); fails += cmp_row("EhlersStochastic", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ehlers_stochastic_free(h); return fails; } static int check_Ehma(void) { struct Ehma *h = wickra_ehma_new((uintptr_t)14); if (!h) { printf("FAIL Ehma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Ehma", &exp); int fails = 0; { const char *nm = wickra_ehma_name(h); if (!nm || strcmp(nm, "EHMA") != 0) { printf("FAIL Ehma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ehma_update(h, c); fails += cmp_row("Ehma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ehma_free(h); return fails; } static int check_ElderImpulse(void) { struct ElderImpulse *h = wickra_elder_impulse_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28); if (!h) { printf("FAIL ElderImpulse: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ElderImpulse", &exp); int fails = 0; { const char *nm = wickra_elder_impulse_name(h); if (!nm || strcmp(nm, "ElderImpulse") != 0) { printf("FAIL ElderImpulse: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_elder_impulse_update(h, c); fails += cmp_row("ElderImpulse", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_elder_impulse_free(h); return fails; } static int check_ElderRay(void) { struct ElderRay *h = wickra_elder_ray_new((uintptr_t)14); if (!h) { printf("FAIL ElderRay: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ElderRay", &exp); int fails = 0; { const char *nm = wickra_elder_ray_name(h); if (!nm || strcmp(nm, "ElderRay") != 0) { printf("FAIL ElderRay: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraElderRayOutput out; if (wickra_elder_ray_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.bull_power; got[gn++] = out.bear_power; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("ElderRay", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_elder_ray_free(h); return fails; } static int check_ElderSafeZone(void) { struct ElderSafeZone *h = wickra_elder_safe_zone_new((uintptr_t)10, 2.0); if (!h) { printf("FAIL ElderSafeZone: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ElderSafeZone", &exp); int fails = 0; { const char *nm = wickra_elder_safe_zone_name(h); if (!nm || strcmp(nm, "ElderSafeZone") != 0) { printf("FAIL ElderSafeZone: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraElderSafeZoneOutput out; if (wickra_elder_safe_zone_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.value; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("ElderSafeZone", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_elder_safe_zone_free(h); return fails; } static int check_Ema(void) { struct Ema *h = wickra_ema_new((uintptr_t)14); if (!h) { printf("FAIL Ema: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Ema", &exp); int fails = 0; { const char *nm = wickra_ema_name(h); if (!nm || strcmp(nm, "EMA") != 0) { printf("FAIL Ema: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ema_update(h, c); fails += cmp_row("Ema", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ema_free(h); return fails; } static int check_EmpiricalModeDecomposition(void) { struct EmpiricalModeDecomposition *h = wickra_empirical_mode_decomposition_new((uintptr_t)20, 0.1); if (!h) { printf("FAIL EmpiricalModeDecomposition: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EmpiricalModeDecomposition", &exp); int fails = 0; { const char *nm = wickra_empirical_mode_decomposition_name(h); if (!nm || strcmp(nm, "EmpiricalModeDecomposition") != 0) { printf("FAIL EmpiricalModeDecomposition: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_empirical_mode_decomposition_update(h, c); fails += cmp_row("EmpiricalModeDecomposition", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_empirical_mode_decomposition_free(h); return fails; } static int check_Engulfing(void) { struct Engulfing *h = wickra_engulfing_new(); if (!h) { printf("FAIL Engulfing: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Engulfing", &exp); int fails = 0; { const char *nm = wickra_engulfing_name(h); if (!nm || strcmp(nm, "Engulfing") != 0) { printf("FAIL Engulfing: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_engulfing_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Engulfing", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_engulfing_free(h); return fails; } static int check_Equivolume(void) { struct Equivolume *h = wickra_equivolume_new((uintptr_t)14); if (!h) { printf("FAIL Equivolume: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Equivolume", &exp); int fails = 0; { const char *nm = wickra_equivolume_name(h); if (!nm || strcmp(nm, "Equivolume") != 0) { printf("FAIL Equivolume: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraEquivolumeOutput out; if (wickra_equivolume_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.height; got[gn++] = out.width; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Equivolume", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_equivolume_free(h); return fails; } static int check_EstimatedLeverageRatio(void) { struct EstimatedLeverageRatio *h = wickra_estimated_leverage_ratio_new(); if (!h) { printf("FAIL EstimatedLeverageRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EstimatedLeverageRatio", &exp); int fails = 0; { const char *nm = wickra_estimated_leverage_ratio_name(h); if (!nm || strcmp(nm, "EstimatedLeverageRatio") != 0) { printf("FAIL EstimatedLeverageRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_estimated_leverage_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("EstimatedLeverageRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_estimated_leverage_ratio_free(h); return fails; } static int check_EvenBetterSinewave(void) { struct EvenBetterSinewave *h = wickra_even_better_sinewave_new((uintptr_t)40, (uintptr_t)10); if (!h) { printf("FAIL EvenBetterSinewave: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EvenBetterSinewave", &exp); int fails = 0; { const char *nm = wickra_even_better_sinewave_name(h); if (!nm || strcmp(nm, "EvenBetterSinewave") != 0) { printf("FAIL EvenBetterSinewave: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_even_better_sinewave_update(h, c); fails += cmp_row("EvenBetterSinewave", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_even_better_sinewave_free(h); return fails; } static int check_EveningDojiStar(void) { struct EveningDojiStar *h = wickra_evening_doji_star_new(); if (!h) { printf("FAIL EveningDojiStar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EveningDojiStar", &exp); int fails = 0; { const char *nm = wickra_evening_doji_star_name(h); if (!nm || strcmp(nm, "EveningDojiStar") != 0) { printf("FAIL EveningDojiStar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_evening_doji_star_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("EveningDojiStar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_evening_doji_star_free(h); return fails; } static int check_Evwma(void) { struct Evwma *h = wickra_evwma_new((uintptr_t)14); if (!h) { printf("FAIL Evwma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Evwma", &exp); int fails = 0; { const char *nm = wickra_evwma_name(h); if (!nm || strcmp(nm, "EVWMA") != 0) { printf("FAIL Evwma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_evwma_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Evwma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_evwma_free(h); return fails; } static int check_EwmaVolatility(void) { struct EwmaVolatility *h = wickra_ewma_volatility_new(0.94); if (!h) { printf("FAIL EwmaVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_EwmaVolatility", &exp); int fails = 0; { const char *nm = wickra_ewma_volatility_name(h); if (!nm || strcmp(nm, "EwmaVolatility") != 0) { printf("FAIL EwmaVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ewma_volatility_update(h, c); fails += cmp_row("EwmaVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ewma_volatility_free(h); return fails; } static int check_Expectancy(void) { struct Expectancy *h = wickra_expectancy_new((uintptr_t)14); if (!h) { printf("FAIL Expectancy: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Expectancy", &exp); int fails = 0; { const char *nm = wickra_expectancy_name(h); if (!nm || strcmp(nm, "Expectancy") != 0) { printf("FAIL Expectancy: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_expectancy_update(h, c); fails += cmp_row("Expectancy", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_expectancy_free(h); return fails; } static int check_FallingThreeMethods(void) { struct FallingThreeMethods *h = wickra_falling_three_methods_new(); if (!h) { printf("FAIL FallingThreeMethods: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FallingThreeMethods", &exp); int fails = 0; { const char *nm = wickra_falling_three_methods_name(h); if (!nm || strcmp(nm, "FallingThreeMethods") != 0) { printf("FAIL FallingThreeMethods: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_falling_three_methods_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("FallingThreeMethods", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_falling_three_methods_free(h); return fails; } static int check_Fama(void) { struct Fama *h = wickra_fama_new(0.5, 0.05); if (!h) { printf("FAIL Fama: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Fama", &exp); int fails = 0; { const char *nm = wickra_fama_name(h); if (!nm || strcmp(nm, "FAMA") != 0) { printf("FAIL Fama: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_fama_update(h, c); fails += cmp_row("Fama", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fama_free(h); return fails; } static int check_FibArcs(void) { struct FibArcs *h = wickra_fib_arcs_new(); if (!h) { printf("FAIL FibArcs: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibArcs", &exp); int fails = 0; { const char *nm = wickra_fib_arcs_name(h); if (!nm || strcmp(nm, "FibArcs") != 0) { printf("FAIL FibArcs: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibArcsOutput out; if (wickra_fib_arcs_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.arc_382; got[gn++] = out.arc_500; got[gn++] = out.arc_618; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("FibArcs", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_arcs_free(h); return fails; } static int check_FibChannel(void) { struct FibChannel *h = wickra_fib_channel_new(); if (!h) { printf("FAIL FibChannel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibChannel", &exp); int fails = 0; { const char *nm = wickra_fib_channel_name(h); if (!nm || strcmp(nm, "FibChannel") != 0) { printf("FAIL FibChannel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibChannelOutput out; if (wickra_fib_channel_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.base; got[gn++] = out.level_618; got[gn++] = out.level_1000; got[gn++] = out.level_1618; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("FibChannel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_channel_free(h); return fails; } static int check_FibConfluence(void) { struct FibConfluence *h = wickra_fib_confluence_new(); if (!h) { printf("FAIL FibConfluence: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibConfluence", &exp); int fails = 0; { const char *nm = wickra_fib_confluence_name(h); if (!nm || strcmp(nm, "FibConfluence") != 0) { printf("FAIL FibConfluence: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibConfluenceOutput out; if (wickra_fib_confluence_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.price; got[gn++] = out.strength; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("FibConfluence", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_confluence_free(h); return fails; } static int check_FibExtension(void) { struct FibExtension *h = wickra_fib_extension_new(); if (!h) { printf("FAIL FibExtension: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibExtension", &exp); int fails = 0; { const char *nm = wickra_fib_extension_name(h); if (!nm || strcmp(nm, "FibExtension") != 0) { printf("FAIL FibExtension: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibExtensionOutput out; if (wickra_fib_extension_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.level_1272; got[gn++] = out.level_1414; got[gn++] = out.level_1618; got[gn++] = out.level_2000; got[gn++] = out.level_2618; } else { for (int z = 0; z < 5; z++) got[gn++] = NANV; } fails += cmp_row("FibExtension", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_extension_free(h); return fails; } static int check_FibFan(void) { struct FibFan *h = wickra_fib_fan_new(); if (!h) { printf("FAIL FibFan: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibFan", &exp); int fails = 0; { const char *nm = wickra_fib_fan_name(h); if (!nm || strcmp(nm, "FibFan") != 0) { printf("FAIL FibFan: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibFanOutput out; if (wickra_fib_fan_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.fan_382; got[gn++] = out.fan_500; got[gn++] = out.fan_618; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("FibFan", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_fan_free(h); return fails; } static int check_FibProjection(void) { struct FibProjection *h = wickra_fib_projection_new(); if (!h) { printf("FAIL FibProjection: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibProjection", &exp); int fails = 0; { const char *nm = wickra_fib_projection_name(h); if (!nm || strcmp(nm, "FibProjection") != 0) { printf("FAIL FibProjection: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibProjectionOutput out; if (wickra_fib_projection_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.level_618; got[gn++] = out.level_1000; got[gn++] = out.level_1618; got[gn++] = out.level_2618; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("FibProjection", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_projection_free(h); return fails; } static int check_FibRetracement(void) { struct FibRetracement *h = wickra_fib_retracement_new(); if (!h) { printf("FAIL FibRetracement: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibRetracement", &exp); int fails = 0; { const char *nm = wickra_fib_retracement_name(h); if (!nm || strcmp(nm, "FibRetracement") != 0) { printf("FAIL FibRetracement: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibRetracementOutput out; if (wickra_fib_retracement_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.level_0; got[gn++] = out.level_236; got[gn++] = out.level_382; got[gn++] = out.level_500; got[gn++] = out.level_618; got[gn++] = out.level_786; got[gn++] = out.level_1000; } else { for (int z = 0; z < 7; z++) got[gn++] = NANV; } fails += cmp_row("FibRetracement", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_retracement_free(h); return fails; } static int check_FibTimeZones(void) { struct FibTimeZones *h = wickra_fib_time_zones_new(); if (!h) { printf("FAIL FibTimeZones: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibTimeZones", &exp); int fails = 0; { const char *nm = wickra_fib_time_zones_name(h); if (!nm || strcmp(nm, "FibTimeZones") != 0) { printf("FAIL FibTimeZones: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibTimeZonesOutput out; if (wickra_fib_time_zones_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.on_zone; got[gn++] = out.bars_to_next; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("FibTimeZones", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fib_time_zones_free(h); return fails; } static int check_FibonacciPivots(void) { struct FibonacciPivots *h = wickra_fibonacci_pivots_new(); if (!h) { printf("FAIL FibonacciPivots: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FibonacciPivots", &exp); int fails = 0; { const char *nm = wickra_fibonacci_pivots_name(h); if (!nm || strcmp(nm, "FibonacciPivots") != 0) { printf("FAIL FibonacciPivots: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFibonacciPivotsOutput out; if (wickra_fibonacci_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.pp; got[gn++] = out.r1; got[gn++] = out.r2; got[gn++] = out.r3; got[gn++] = out.s1; got[gn++] = out.s2; got[gn++] = out.s3; } else { for (int z = 0; z < 7; z++) got[gn++] = NANV; } fails += cmp_row("FibonacciPivots", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fibonacci_pivots_free(h); return fails; } static int check_FisherRsi(void) { struct FisherRsi *h = wickra_fisher_rsi_new((uintptr_t)14); if (!h) { printf("FAIL FisherRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FisherRsi", &exp); int fails = 0; { const char *nm = wickra_fisher_rsi_name(h); if (!nm || strcmp(nm, "FisherRSI") != 0) { printf("FAIL FisherRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_fisher_rsi_update(h, c); fails += cmp_row("FisherRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fisher_rsi_free(h); return fails; } static int check_FisherTransform(void) { struct FisherTransform *h = wickra_fisher_transform_new((uintptr_t)14); if (!h) { printf("FAIL FisherTransform: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FisherTransform", &exp); int fails = 0; { const char *nm = wickra_fisher_transform_name(h); if (!nm || strcmp(nm, "FisherTransform") != 0) { printf("FAIL FisherTransform: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_fisher_transform_update(h, c); fails += cmp_row("FisherTransform", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fisher_transform_free(h); return fails; } static int check_FlagPennant(void) { struct FlagPennant *h = wickra_flag_pennant_new(); if (!h) { printf("FAIL FlagPennant: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FlagPennant", &exp); int fails = 0; { const char *nm = wickra_flag_pennant_name(h); if (!nm || strcmp(nm, "FlagPennant") != 0) { printf("FAIL FlagPennant: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_flag_pennant_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("FlagPennant", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_flag_pennant_free(h); return fails; } static int check_Footprint(void) { struct Footprint *h = wickra_footprint_new(1.0); if (!h) { printf("FAIL Footprint: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Footprint", &exp); int fails = 0; { const char *nm = wickra_footprint_name(h); if (!nm || strcmp(nm, "Footprint") != 0) { printf("FAIL Footprint: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFootprintLevel bbuf[256]; intptr_t k = wickra_footprint_update(h, c, v, c >= o, (int64_t)i, bbuf, 256); if (k < 0) k = 0; for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].price; got[gn++] = (double)bbuf[b].bid_vol; got[gn++] = (double)bbuf[b].ask_vol; } fails += cmp_row("Footprint", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_footprint_free(h); return fails; } static int check_ForceIndex(void) { struct ForceIndex *h = wickra_force_index_new((uintptr_t)14); if (!h) { printf("FAIL ForceIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ForceIndex", &exp); int fails = 0; { const char *nm = wickra_force_index_name(h); if (!nm || strcmp(nm, "ForceIndex") != 0) { printf("FAIL ForceIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_force_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ForceIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_force_index_free(h); return fails; } static int check_FractalChaosBands(void) { struct FractalChaosBands *h = wickra_fractal_chaos_bands_new((uintptr_t)14); if (!h) { printf("FAIL FractalChaosBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FractalChaosBands", &exp); int fails = 0; { const char *nm = wickra_fractal_chaos_bands_name(h); if (!nm || strcmp(nm, "FractalChaosBands") != 0) { printf("FAIL FractalChaosBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraFractalChaosBandsOutput out; if (wickra_fractal_chaos_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.lower; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("FractalChaosBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fractal_chaos_bands_free(h); return fails; } static int check_Frama(void) { struct Frama *h = wickra_frama_new((uintptr_t)14); if (!h) { printf("FAIL Frama: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Frama", &exp); int fails = 0; { const char *nm = wickra_frama_name(h); if (!nm || strcmp(nm, "FRAMA") != 0) { printf("FAIL Frama: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_frama_update(h, c); fails += cmp_row("Frama", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_frama_free(h); return fails; } static int check_FryPanBottom(void) { struct FryPanBottom *h = wickra_fry_pan_bottom_new((uintptr_t)14); if (!h) { printf("FAIL FryPanBottom: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FryPanBottom", &exp); int fails = 0; { const char *nm = wickra_fry_pan_bottom_name(h); if (!nm || strcmp(nm, "FryPanBottom") != 0) { printf("FAIL FryPanBottom: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_fry_pan_bottom_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("FryPanBottom", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_fry_pan_bottom_free(h); return fails; } static int check_FundingBasis(void) { struct FundingBasis *h = wickra_funding_basis_new(); if (!h) { printf("FAIL FundingBasis: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FundingBasis", &exp); int fails = 0; { const char *nm = wickra_funding_basis_name(h); if (!nm || strcmp(nm, "FundingBasis") != 0) { printf("FAIL FundingBasis: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_funding_basis_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("FundingBasis", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_funding_basis_free(h); return fails; } static int check_FundingImpliedApr(void) { struct FundingImpliedApr *h = wickra_funding_implied_apr_new(1095.0); if (!h) { printf("FAIL FundingImpliedApr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FundingImpliedApr", &exp); int fails = 0; { const char *nm = wickra_funding_implied_apr_name(h); if (!nm || strcmp(nm, "FundingImpliedApr") != 0) { printf("FAIL FundingImpliedApr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_funding_implied_apr_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("FundingImpliedApr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_funding_implied_apr_free(h); return fails; } static int check_FundingRate(void) { struct FundingRate *h = wickra_funding_rate_new(); if (!h) { printf("FAIL FundingRate: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FundingRate", &exp); int fails = 0; { const char *nm = wickra_funding_rate_name(h); if (!nm || strcmp(nm, "FundingRate") != 0) { printf("FAIL FundingRate: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_funding_rate_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("FundingRate", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_funding_rate_free(h); return fails; } static int check_FundingRateMean(void) { struct FundingRateMean *h = wickra_funding_rate_mean_new((uintptr_t)20); if (!h) { printf("FAIL FundingRateMean: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FundingRateMean", &exp); int fails = 0; { const char *nm = wickra_funding_rate_mean_name(h); if (!nm || strcmp(nm, "FundingRateMean") != 0) { printf("FAIL FundingRateMean: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_funding_rate_mean_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("FundingRateMean", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_funding_rate_mean_free(h); return fails; } static int check_FundingRateZScore(void) { struct FundingRateZScore *h = wickra_funding_rate_z_score_new((uintptr_t)20); if (!h) { printf("FAIL FundingRateZScore: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_FundingRateZScore", &exp); int fails = 0; { const char *nm = wickra_funding_rate_z_score_name(h); if (!nm || strcmp(nm, "FundingRateZScore") != 0) { printf("FAIL FundingRateZScore: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_funding_rate_z_score_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("FundingRateZScore", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_funding_rate_z_score_free(h); return fails; } static int check_GainLossRatio(void) { struct GainLossRatio *h = wickra_gain_loss_ratio_new((uintptr_t)14); if (!h) { printf("FAIL GainLossRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GainLossRatio", &exp); int fails = 0; { const char *nm = wickra_gain_loss_ratio_name(h); if (!nm || strcmp(nm, "GainLossRatio") != 0) { printf("FAIL GainLossRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_gain_loss_ratio_update(h, c); fails += cmp_row("GainLossRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_gain_loss_ratio_free(h); return fails; } static int check_GainToPainRatio(void) { struct GainToPainRatio *h = wickra_gain_to_pain_ratio_new((uintptr_t)14); if (!h) { printf("FAIL GainToPainRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GainToPainRatio", &exp); int fails = 0; { const char *nm = wickra_gain_to_pain_ratio_name(h); if (!nm || strcmp(nm, "GainToPainRatio") != 0) { printf("FAIL GainToPainRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_gain_to_pain_ratio_update(h, c); fails += cmp_row("GainToPainRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_gain_to_pain_ratio_free(h); return fails; } static int check_GapSideBySideWhite(void) { struct GapSideBySideWhite *h = wickra_gap_side_by_side_white_new(); if (!h) { printf("FAIL GapSideBySideWhite: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GapSideBySideWhite", &exp); int fails = 0; { const char *nm = wickra_gap_side_by_side_white_name(h); if (!nm || strcmp(nm, "GapSideBySideWhite") != 0) { printf("FAIL GapSideBySideWhite: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_gap_side_by_side_white_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("GapSideBySideWhite", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_gap_side_by_side_white_free(h); return fails; } static int check_Garch11(void) { struct Garch11 *h = wickra_garch11_new(2e-06, 0.1, 0.88); if (!h) { printf("FAIL Garch11: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Garch11", &exp); int fails = 0; { const char *nm = wickra_garch11_name(h); if (!nm || strcmp(nm, "Garch11") != 0) { printf("FAIL Garch11: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_garch11_update(h, c); fails += cmp_row("Garch11", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_garch11_free(h); return fails; } static int check_GarmanKlassVolatility(void) { struct GarmanKlassVolatility *h = wickra_garman_klass_volatility_new((uintptr_t)20, (uintptr_t)252); if (!h) { printf("FAIL GarmanKlassVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GarmanKlassVolatility", &exp); int fails = 0; { const char *nm = wickra_garman_klass_volatility_name(h); if (!nm || strcmp(nm, "GarmanKlassVolatility") != 0) { printf("FAIL GarmanKlassVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_garman_klass_volatility_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("GarmanKlassVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_garman_klass_volatility_free(h); return fails; } static int check_Gartley(void) { struct Gartley *h = wickra_gartley_new(); if (!h) { printf("FAIL Gartley: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Gartley", &exp); int fails = 0; { const char *nm = wickra_gartley_name(h); if (!nm || strcmp(nm, "Gartley") != 0) { printf("FAIL Gartley: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_gartley_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Gartley", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_gartley_free(h); return fails; } static int check_GatorOscillator(void) { struct GatorOscillator *h = wickra_gator_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL GatorOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GatorOscillator", &exp); int fails = 0; { const char *nm = wickra_gator_oscillator_name(h); if (!nm || strcmp(nm, "GatorOscillator") != 0) { printf("FAIL GatorOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraGatorOscillatorOutput out; if (wickra_gator_oscillator_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.lower; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("GatorOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_gator_oscillator_free(h); return fails; } static int check_GeneralizedDema(void) { struct GeneralizedDema *h = wickra_generalized_dema_new((uintptr_t)5, 0.7); if (!h) { printf("FAIL GeneralizedDema: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GeneralizedDema", &exp); int fails = 0; { const char *nm = wickra_generalized_dema_name(h); if (!nm || strcmp(nm, "GD") != 0) { printf("FAIL GeneralizedDema: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_generalized_dema_update(h, c); fails += cmp_row("GeneralizedDema", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_generalized_dema_free(h); return fails; } static int check_GeometricMa(void) { struct GeometricMa *h = wickra_geometric_ma_new((uintptr_t)14); if (!h) { printf("FAIL GeometricMa: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GeometricMa", &exp); int fails = 0; { const char *nm = wickra_geometric_ma_name(h); if (!nm || strcmp(nm, "GMA") != 0) { printf("FAIL GeometricMa: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_geometric_ma_update(h, c); fails += cmp_row("GeometricMa", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_geometric_ma_free(h); return fails; } static int check_GoldenPocket(void) { struct GoldenPocket *h = wickra_golden_pocket_new(); if (!h) { printf("FAIL GoldenPocket: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GoldenPocket", &exp); int fails = 0; { const char *nm = wickra_golden_pocket_name(h); if (!nm || strcmp(nm, "GoldenPocket") != 0) { printf("FAIL GoldenPocket: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraGoldenPocketOutput out; if (wickra_golden_pocket_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.low; got[gn++] = out.mid; got[gn++] = out.high; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("GoldenPocket", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_golden_pocket_free(h); return fails; } static int check_GrangerCausality(void) { struct GrangerCausality *h = wickra_granger_causality_new((uintptr_t)60, (uintptr_t)1); if (!h) { printf("FAIL GrangerCausality: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GrangerCausality", &exp); int fails = 0; { const char *nm = wickra_granger_causality_name(h); if (!nm || strcmp(nm, "GrangerCausality") != 0) { printf("FAIL GrangerCausality: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_granger_causality_update(h, c, o); fails += cmp_row("GrangerCausality", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_granger_causality_free(h); return fails; } static int check_GravestoneDoji(void) { struct GravestoneDoji *h = wickra_gravestone_doji_new(); if (!h) { printf("FAIL GravestoneDoji: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_GravestoneDoji", &exp); int fails = 0; { const char *nm = wickra_gravestone_doji_name(h); if (!nm || strcmp(nm, "GravestoneDoji") != 0) { printf("FAIL GravestoneDoji: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_gravestone_doji_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("GravestoneDoji", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_gravestone_doji_free(h); return fails; } static int check_Hammer(void) { struct Hammer *h = wickra_hammer_new(); if (!h) { printf("FAIL Hammer: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Hammer", &exp); int fails = 0; { const char *nm = wickra_hammer_name(h); if (!nm || strcmp(nm, "Hammer") != 0) { printf("FAIL Hammer: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hammer_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Hammer", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hammer_free(h); return fails; } static int check_HangingMan(void) { struct HangingMan *h = wickra_hanging_man_new(); if (!h) { printf("FAIL HangingMan: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HangingMan", &exp); int fails = 0; { const char *nm = wickra_hanging_man_name(h); if (!nm || strcmp(nm, "HangingMan") != 0) { printf("FAIL HangingMan: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hanging_man_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HangingMan", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hanging_man_free(h); return fails; } static int check_Harami(void) { struct Harami *h = wickra_harami_new(); if (!h) { printf("FAIL Harami: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Harami", &exp); int fails = 0; { const char *nm = wickra_harami_name(h); if (!nm || strcmp(nm, "Harami") != 0) { printf("FAIL Harami: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_harami_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Harami", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_harami_free(h); return fails; } static int check_HaramiCross(void) { struct HaramiCross *h = wickra_harami_cross_new(); if (!h) { printf("FAIL HaramiCross: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HaramiCross", &exp); int fails = 0; { const char *nm = wickra_harami_cross_name(h); if (!nm || strcmp(nm, "HaramiCross") != 0) { printf("FAIL HaramiCross: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_harami_cross_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HaramiCross", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_harami_cross_free(h); return fails; } static int check_HasbrouckInformationShare(void) { struct HasbrouckInformationShare *h = wickra_hasbrouck_information_share_new((uintptr_t)14); if (!h) { printf("FAIL HasbrouckInformationShare: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HasbrouckInformationShare", &exp); int fails = 0; { const char *nm = wickra_hasbrouck_information_share_name(h); if (!nm || strcmp(nm, "HasbrouckInformationShare") != 0) { printf("FAIL HasbrouckInformationShare: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hasbrouck_information_share_update(h, c, o); fails += cmp_row("HasbrouckInformationShare", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hasbrouck_information_share_free(h); return fails; } static int check_HeadAndShoulders(void) { struct HeadAndShoulders *h = wickra_head_and_shoulders_new(); if (!h) { printf("FAIL HeadAndShoulders: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HeadAndShoulders", &exp); int fails = 0; { const char *nm = wickra_head_and_shoulders_name(h); if (!nm || strcmp(nm, "HeadAndShoulders") != 0) { printf("FAIL HeadAndShoulders: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_head_and_shoulders_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HeadAndShoulders", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_head_and_shoulders_free(h); return fails; } static int check_HeikinAshi(void) { struct HeikinAshi *h = wickra_heikin_ashi_new(); if (!h) { printf("FAIL HeikinAshi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HeikinAshi", &exp); int fails = 0; { const char *nm = wickra_heikin_ashi_name(h); if (!nm || strcmp(nm, "HeikinAshi") != 0) { printf("FAIL HeikinAshi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraHeikinAshiOutput out; if (wickra_heikin_ashi_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.open; got[gn++] = out.high; got[gn++] = out.low; got[gn++] = out.close; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("HeikinAshi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_heikin_ashi_free(h); return fails; } static int check_HeikinAshiOscillator(void) { struct HeikinAshiOscillator *h = wickra_heikin_ashi_oscillator_new((uintptr_t)14); if (!h) { printf("FAIL HeikinAshiOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HeikinAshiOscillator", &exp); int fails = 0; { const char *nm = wickra_heikin_ashi_oscillator_name(h); if (!nm || strcmp(nm, "HeikinAshiOscillator") != 0) { printf("FAIL HeikinAshiOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_heikin_ashi_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HeikinAshiOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_heikin_ashi_oscillator_free(h); return fails; } static int check_HiLoActivator(void) { struct HiLoActivator *h = wickra_hi_lo_activator_new((uintptr_t)14); if (!h) { printf("FAIL HiLoActivator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HiLoActivator", &exp); int fails = 0; { const char *nm = wickra_hi_lo_activator_name(h); if (!nm || strcmp(nm, "HiLoActivator") != 0) { printf("FAIL HiLoActivator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hi_lo_activator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HiLoActivator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hi_lo_activator_free(h); return fails; } static int check_HighLowIndex(void) { struct HighLowIndex *h = wickra_high_low_index_new((uintptr_t)10); if (!h) { printf("FAIL HighLowIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HighLowIndex", &exp); int fails = 0; { const char *nm = wickra_high_low_index_name(h); if (!nm || strcmp(nm, "HighLowIndex") != 0) { printf("FAIL HighLowIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_high_low_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("HighLowIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_high_low_index_free(h); return fails; } static int check_HighLowRange(void) { struct HighLowRange *h = wickra_high_low_range_new(); if (!h) { printf("FAIL HighLowRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HighLowRange", &exp); int fails = 0; { const char *nm = wickra_high_low_range_name(h); if (!nm || strcmp(nm, "HighLowRange") != 0) { printf("FAIL HighLowRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_high_low_range_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HighLowRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_high_low_range_free(h); return fails; } static int check_HighLowVolumeNodes(void) { struct HighLowVolumeNodes *h = wickra_high_low_volume_nodes_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL HighLowVolumeNodes: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HighLowVolumeNodes", &exp); int fails = 0; { const char *nm = wickra_high_low_volume_nodes_name(h); if (!nm || strcmp(nm, "HighLowVolumeNodes") != 0) { printf("FAIL HighLowVolumeNodes: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraHighLowVolumeNodesOutput out; if (wickra_high_low_volume_nodes_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.hvn; got[gn++] = out.lvn; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("HighLowVolumeNodes", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_high_low_volume_nodes_free(h); return fails; } static int check_HighWave(void) { struct HighWave *h = wickra_high_wave_new(); if (!h) { printf("FAIL HighWave: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HighWave", &exp); int fails = 0; { const char *nm = wickra_high_wave_name(h); if (!nm || strcmp(nm, "HighWave") != 0) { printf("FAIL HighWave: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_high_wave_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HighWave", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_high_wave_free(h); return fails; } static int check_HighpassFilter(void) { struct HighpassFilter *h = wickra_highpass_filter_new((uintptr_t)14); if (!h) { printf("FAIL HighpassFilter: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HighpassFilter", &exp); int fails = 0; { const char *nm = wickra_highpass_filter_name(h); if (!nm || strcmp(nm, "HighpassFilter") != 0) { printf("FAIL HighpassFilter: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_highpass_filter_update(h, c); fails += cmp_row("HighpassFilter", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_highpass_filter_free(h); return fails; } static int check_Hikkake(void) { struct Hikkake *h = wickra_hikkake_new(); if (!h) { printf("FAIL Hikkake: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Hikkake", &exp); int fails = 0; { const char *nm = wickra_hikkake_name(h); if (!nm || strcmp(nm, "Hikkake") != 0) { printf("FAIL Hikkake: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hikkake_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Hikkake", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hikkake_free(h); return fails; } static int check_HikkakeModified(void) { struct HikkakeModified *h = wickra_hikkake_modified_new(); if (!h) { printf("FAIL HikkakeModified: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HikkakeModified", &exp); int fails = 0; { const char *nm = wickra_hikkake_modified_name(h); if (!nm || strcmp(nm, "HikkakeModified") != 0) { printf("FAIL HikkakeModified: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hikkake_modified_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HikkakeModified", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hikkake_modified_free(h); return fails; } static int check_HilbertDominantCycle(void) { struct HilbertDominantCycle *h = wickra_hilbert_dominant_cycle_new(); if (!h) { printf("FAIL HilbertDominantCycle: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HilbertDominantCycle", &exp); int fails = 0; { const char *nm = wickra_hilbert_dominant_cycle_name(h); if (!nm || strcmp(nm, "HilbertDominantCycle") != 0) { printf("FAIL HilbertDominantCycle: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hilbert_dominant_cycle_update(h, c); fails += cmp_row("HilbertDominantCycle", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hilbert_dominant_cycle_free(h); return fails; } static int check_HistoricalVolatility(void) { struct HistoricalVolatility *h = wickra_historical_volatility_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL HistoricalVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HistoricalVolatility", &exp); int fails = 0; { const char *nm = wickra_historical_volatility_name(h); if (!nm || strcmp(nm, "HistoricalVolatility") != 0) { printf("FAIL HistoricalVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_historical_volatility_update(h, c); fails += cmp_row("HistoricalVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_historical_volatility_free(h); return fails; } static int check_Hma(void) { struct Hma *h = wickra_hma_new((uintptr_t)14); if (!h) { printf("FAIL Hma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Hma", &exp); int fails = 0; { const char *nm = wickra_hma_name(h); if (!nm || strcmp(nm, "HMA") != 0) { printf("FAIL Hma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hma_update(h, c); fails += cmp_row("Hma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hma_free(h); return fails; } static int check_HoltWinters(void) { struct HoltWinters *h = wickra_holt_winters_new(0.5, 0.1); if (!h) { printf("FAIL HoltWinters: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HoltWinters", &exp); int fails = 0; { const char *nm = wickra_holt_winters_name(h); if (!nm || strcmp(nm, "HoltWinters") != 0) { printf("FAIL HoltWinters: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_holt_winters_update(h, c); fails += cmp_row("HoltWinters", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_holt_winters_free(h); return fails; } static int check_HomingPigeon(void) { struct HomingPigeon *h = wickra_homing_pigeon_new(); if (!h) { printf("FAIL HomingPigeon: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HomingPigeon", &exp); int fails = 0; { const char *nm = wickra_homing_pigeon_name(h); if (!nm || strcmp(nm, "HomingPigeon") != 0) { printf("FAIL HomingPigeon: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_homing_pigeon_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("HomingPigeon", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_homing_pigeon_free(h); return fails; } static int check_HtDcPhase(void) { struct HtDcPhase *h = wickra_ht_dc_phase_new(); if (!h) { printf("FAIL HtDcPhase: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HtDcPhase", &exp); int fails = 0; { const char *nm = wickra_ht_dc_phase_name(h); if (!nm || strcmp(nm, "HT_DCPHASE") != 0) { printf("FAIL HtDcPhase: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ht_dc_phase_update(h, c); fails += cmp_row("HtDcPhase", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ht_dc_phase_free(h); return fails; } static int check_HtPhasor(void) { struct HtPhasor *h = wickra_ht_phasor_new(); if (!h) { printf("FAIL HtPhasor: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HtPhasor", &exp); int fails = 0; { const char *nm = wickra_ht_phasor_name(h); if (!nm || strcmp(nm, "HT_PHASOR") != 0) { printf("FAIL HtPhasor: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraHtPhasorOutput out; if (wickra_ht_phasor_update(h, c, &out)) { got[gn++] = out.inphase; got[gn++] = out.quadrature; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("HtPhasor", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ht_phasor_free(h); return fails; } static int check_HtTrendMode(void) { struct HtTrendMode *h = wickra_ht_trend_mode_new(); if (!h) { printf("FAIL HtTrendMode: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HtTrendMode", &exp); int fails = 0; { const char *nm = wickra_ht_trend_mode_name(h); if (!nm || strcmp(nm, "HT_TRENDMODE") != 0) { printf("FAIL HtTrendMode: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ht_trend_mode_update(h, c); fails += cmp_row("HtTrendMode", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ht_trend_mode_free(h); return fails; } static int check_HurstChannel(void) { struct HurstChannel *h = wickra_hurst_channel_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL HurstChannel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HurstChannel", &exp); int fails = 0; { const char *nm = wickra_hurst_channel_name(h); if (!nm || strcmp(nm, "HurstChannel") != 0) { printf("FAIL HurstChannel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraHurstChannelOutput out; if (wickra_hurst_channel_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("HurstChannel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hurst_channel_free(h); return fails; } static int check_HurstExponent(void) { struct HurstExponent *h = wickra_hurst_exponent_new((uintptr_t)100, (uintptr_t)4); if (!h) { printf("FAIL HurstExponent: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_HurstExponent", &exp); int fails = 0; { const char *nm = wickra_hurst_exponent_name(h); if (!nm || strcmp(nm, "HurstExponent") != 0) { printf("FAIL HurstExponent: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_hurst_exponent_update(h, c); fails += cmp_row("HurstExponent", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_hurst_exponent_free(h); return fails; } static int check_Ichimoku(void) { struct Ichimoku *h = wickra_ichimoku_new((uintptr_t)9, (uintptr_t)26, (uintptr_t)52, (uintptr_t)26); if (!h) { printf("FAIL Ichimoku: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Ichimoku", &exp); int fails = 0; { const char *nm = wickra_ichimoku_name(h); if (!nm || strcmp(nm, "Ichimoku") != 0) { printf("FAIL Ichimoku: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraIchimokuOutput out; if (wickra_ichimoku_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.tenkan; got[gn++] = out.kijun; got[gn++] = out.senkou_a; got[gn++] = out.senkou_b; got[gn++] = out.chikou; } else { for (int z = 0; z < 5; z++) got[gn++] = NANV; } fails += cmp_row("Ichimoku", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ichimoku_free(h); return fails; } static int check_IdenticalThreeCrows(void) { struct IdenticalThreeCrows *h = wickra_identical_three_crows_new(); if (!h) { printf("FAIL IdenticalThreeCrows: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_IdenticalThreeCrows", &exp); int fails = 0; { const char *nm = wickra_identical_three_crows_name(h); if (!nm || strcmp(nm, "IdenticalThreeCrows") != 0) { printf("FAIL IdenticalThreeCrows: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_identical_three_crows_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("IdenticalThreeCrows", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_identical_three_crows_free(h); return fails; } static int check_ImbalanceBars(void) { struct ImbalanceBars *h = wickra_imbalance_bars_new(5.0); if (!h) { printf("FAIL ImbalanceBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ImbalanceBars", &exp); int fails = 0; { const char *nm = wickra_imbalance_bars_name(h); if (!nm || strcmp(nm, "ImbalanceBars") != 0) { printf("FAIL ImbalanceBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraImbalanceBar bbuf[256]; uintptr_t k = wickra_imbalance_bars_update(h, o, hi, lo, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].high; got[gn++] = (double)bbuf[b].low; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].imbalance; got[gn++] = (double)bbuf[b].direction; } fails += cmp_row("ImbalanceBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_imbalance_bars_free(h); return fails; } static int check_InNeck(void) { struct InNeck *h = wickra_in_neck_new(); if (!h) { printf("FAIL InNeck: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_InNeck", &exp); int fails = 0; { const char *nm = wickra_in_neck_name(h); if (!nm || strcmp(nm, "InNeck") != 0) { printf("FAIL InNeck: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_in_neck_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("InNeck", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_in_neck_free(h); return fails; } static int check_Inertia(void) { struct Inertia *h = wickra_inertia_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Inertia: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Inertia", &exp); int fails = 0; { const char *nm = wickra_inertia_name(h); if (!nm || strcmp(nm, "Inertia") != 0) { printf("FAIL Inertia: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_inertia_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Inertia", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_inertia_free(h); return fails; } static int check_InformationRatio(void) { struct InformationRatio *h = wickra_information_ratio_new((uintptr_t)14); if (!h) { printf("FAIL InformationRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_InformationRatio", &exp); int fails = 0; { const char *nm = wickra_information_ratio_name(h); if (!nm || strcmp(nm, "InformationRatio") != 0) { printf("FAIL InformationRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_information_ratio_update(h, c, o); fails += cmp_row("InformationRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_information_ratio_free(h); return fails; } static int check_InitialBalance(void) { struct InitialBalance *h = wickra_initial_balance_new((uintptr_t)14); if (!h) { printf("FAIL InitialBalance: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_InitialBalance", &exp); int fails = 0; { const char *nm = wickra_initial_balance_name(h); if (!nm || strcmp(nm, "InitialBalance") != 0) { printf("FAIL InitialBalance: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraInitialBalanceOutput out; if (wickra_initial_balance_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.high; got[gn++] = out.low; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("InitialBalance", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_initial_balance_free(h); return fails; } static int check_InstantaneousTrendline(void) { struct InstantaneousTrendline *h = wickra_instantaneous_trendline_new((uintptr_t)14); if (!h) { printf("FAIL InstantaneousTrendline: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_InstantaneousTrendline", &exp); int fails = 0; { const char *nm = wickra_instantaneous_trendline_name(h); if (!nm || strcmp(nm, "InstantaneousTrendline") != 0) { printf("FAIL InstantaneousTrendline: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_instantaneous_trendline_update(h, c); fails += cmp_row("InstantaneousTrendline", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_instantaneous_trendline_free(h); return fails; } static int check_IntradayIntensity(void) { struct IntradayIntensity *h = wickra_intraday_intensity_new(); if (!h) { printf("FAIL IntradayIntensity: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_IntradayIntensity", &exp); int fails = 0; { const char *nm = wickra_intraday_intensity_name(h); if (!nm || strcmp(nm, "IntradayIntensity") != 0) { printf("FAIL IntradayIntensity: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_intraday_intensity_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("IntradayIntensity", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_intraday_intensity_free(h); return fails; } static int check_IntradayMomentumIndex(void) { struct IntradayMomentumIndex *h = wickra_intraday_momentum_index_new((uintptr_t)14); if (!h) { printf("FAIL IntradayMomentumIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_IntradayMomentumIndex", &exp); int fails = 0; { const char *nm = wickra_intraday_momentum_index_name(h); if (!nm || strcmp(nm, "IMI") != 0) { printf("FAIL IntradayMomentumIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_intraday_momentum_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("IntradayMomentumIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_intraday_momentum_index_free(h); return fails; } static int check_IntradayVolatilityProfile(void) { struct IntradayVolatilityProfile *h = wickra_intraday_volatility_profile_new((uintptr_t)24, (int32_t)0); if (!h) { printf("FAIL IntradayVolatilityProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_IntradayVolatilityProfile", &exp); int fails = 0; { const char *nm = wickra_intraday_volatility_profile_name(h); if (!nm || strcmp(nm, "IntradayVolatilityProfile") != 0) { printf("FAIL IntradayVolatilityProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double vbuf[256]; intptr_t k = wickra_intraday_volatility_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256); if (k < 0) { for (int z = 0; z < 24; z++) got[gn++] = NANV; } else { for (int z = 0; z < 24; z++) got[gn++] = vbuf[z]; } fails += cmp_row("IntradayVolatilityProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_intraday_volatility_profile_free(h); return fails; } static int check_InverseFisherTransform(void) { struct InverseFisherTransform *h = wickra_inverse_fisher_transform_new(2.0); if (!h) { printf("FAIL InverseFisherTransform: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_InverseFisherTransform", &exp); int fails = 0; { const char *nm = wickra_inverse_fisher_transform_name(h); if (!nm || strcmp(nm, "InverseFisherTransform") != 0) { printf("FAIL InverseFisherTransform: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_inverse_fisher_transform_update(h, c); fails += cmp_row("InverseFisherTransform", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_inverse_fisher_transform_free(h); return fails; } static int check_InvertedHammer(void) { struct InvertedHammer *h = wickra_inverted_hammer_new(); if (!h) { printf("FAIL InvertedHammer: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_InvertedHammer", &exp); int fails = 0; { const char *nm = wickra_inverted_hammer_name(h); if (!nm || strcmp(nm, "InvertedHammer") != 0) { printf("FAIL InvertedHammer: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_inverted_hammer_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("InvertedHammer", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_inverted_hammer_free(h); return fails; } static int check_JarqueBera(void) { struct JarqueBera *h = wickra_jarque_bera_new((uintptr_t)14); if (!h) { printf("FAIL JarqueBera: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_JarqueBera", &exp); int fails = 0; { const char *nm = wickra_jarque_bera_name(h); if (!nm || strcmp(nm, "JarqueBera") != 0) { printf("FAIL JarqueBera: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_jarque_bera_update(h, c); fails += cmp_row("JarqueBera", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_jarque_bera_free(h); return fails; } static int check_Jma(void) { struct Jma *h = wickra_jma_new((uintptr_t)7, 0.0, 2.0); if (!h) { printf("FAIL Jma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Jma", &exp); int fails = 0; { const char *nm = wickra_jma_name(h); if (!nm || strcmp(nm, "JMA") != 0) { printf("FAIL Jma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_jma_update(h, c); fails += cmp_row("Jma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_jma_free(h); return fails; } static int check_JumpIndicator(void) { struct JumpIndicator *h = wickra_jump_indicator_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL JumpIndicator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_JumpIndicator", &exp); int fails = 0; { const char *nm = wickra_jump_indicator_name(h); if (!nm || strcmp(nm, "JumpIndicator") != 0) { printf("FAIL JumpIndicator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_jump_indicator_update(h, c); fails += cmp_row("JumpIndicator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_jump_indicator_free(h); return fails; } static int check_KRatio(void) { struct KRatio *h = wickra_k_ratio_new((uintptr_t)14); if (!h) { printf("FAIL KRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KRatio", &exp); int fails = 0; { const char *nm = wickra_k_ratio_name(h); if (!nm || strcmp(nm, "KRatio") != 0) { printf("FAIL KRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_k_ratio_update(h, c); fails += cmp_row("KRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_k_ratio_free(h); return fails; } static int check_KagiBars(void) { struct KagiBars *h = wickra_kagi_bars_new(2.0); if (!h) { printf("FAIL KagiBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KagiBars", &exp); int fails = 0; { const char *nm = wickra_kagi_bars_name(h); if (!nm || strcmp(nm, "KagiBars") != 0) { printf("FAIL KagiBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraKagiBar bbuf[256]; uintptr_t k = wickra_kagi_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].start; got[gn++] = (double)bbuf[b].end; got[gn++] = (double)bbuf[b].direction; } fails += cmp_row("KagiBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kagi_bars_free(h); return fails; } static int check_KalmanHedgeRatio(void) { struct KalmanHedgeRatio *h = wickra_kalman_hedge_ratio_new(0.01, 0.001); if (!h) { printf("FAIL KalmanHedgeRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KalmanHedgeRatio", &exp); int fails = 0; { const char *nm = wickra_kalman_hedge_ratio_name(h); if (!nm || strcmp(nm, "KalmanHedgeRatio") != 0) { printf("FAIL KalmanHedgeRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraKalmanHedgeRatioOutput out; if (wickra_kalman_hedge_ratio_update(h, c, o, &out)) { got[gn++] = out.hedge_ratio; got[gn++] = out.intercept; got[gn++] = out.spread; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("KalmanHedgeRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kalman_hedge_ratio_free(h); return fails; } static int check_Kama(void) { struct Kama *h = wickra_kama_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL Kama: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Kama", &exp); int fails = 0; { const char *nm = wickra_kama_name(h); if (!nm || strcmp(nm, "KAMA") != 0) { printf("FAIL Kama: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kama_update(h, c); fails += cmp_row("Kama", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kama_free(h); return fails; } static int check_KaseDevStop(void) { struct KaseDevStop *h = wickra_kase_dev_stop_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL KaseDevStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KaseDevStop", &exp); int fails = 0; { const char *nm = wickra_kase_dev_stop_name(h); if (!nm || strcmp(nm, "KaseDevStop") != 0) { printf("FAIL KaseDevStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraKaseDevStopOutput out; if (wickra_kase_dev_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.value; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("KaseDevStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kase_dev_stop_free(h); return fails; } static int check_KasePermissionStochastic(void) { struct KasePermissionStochastic *h = wickra_kase_permission_stochastic_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL KasePermissionStochastic: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KasePermissionStochastic", &exp); int fails = 0; { const char *nm = wickra_kase_permission_stochastic_name(h); if (!nm || strcmp(nm, "KasePermissionStochastic") != 0) { printf("FAIL KasePermissionStochastic: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraKasePermissionStochasticOutput out; if (wickra_kase_permission_stochastic_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.fast; got[gn++] = out.slow; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("KasePermissionStochastic", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kase_permission_stochastic_free(h); return fails; } static int check_KellyCriterion(void) { struct KellyCriterion *h = wickra_kelly_criterion_new((uintptr_t)14); if (!h) { printf("FAIL KellyCriterion: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KellyCriterion", &exp); int fails = 0; { const char *nm = wickra_kelly_criterion_name(h); if (!nm || strcmp(nm, "KellyCriterion") != 0) { printf("FAIL KellyCriterion: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kelly_criterion_update(h, c); fails += cmp_row("KellyCriterion", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kelly_criterion_free(h); return fails; } static int check_Keltner(void) { struct Keltner *h = wickra_keltner_new((uintptr_t)3, (uintptr_t)7, 2.0); if (!h) { printf("FAIL Keltner: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Keltner", &exp); int fails = 0; { const char *nm = wickra_keltner_name(h); if (!nm || strcmp(nm, "KeltnerChannels") != 0) { printf("FAIL Keltner: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraKeltnerOutput out; if (wickra_keltner_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("Keltner", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_keltner_free(h); return fails; } static int check_KendallTau(void) { struct KendallTau *h = wickra_kendall_tau_new((uintptr_t)14); if (!h) { printf("FAIL KendallTau: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KendallTau", &exp); int fails = 0; { const char *nm = wickra_kendall_tau_name(h); if (!nm || strcmp(nm, "KendallTau") != 0) { printf("FAIL KendallTau: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kendall_tau_update(h, c, o); fails += cmp_row("KendallTau", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kendall_tau_free(h); return fails; } static int check_Kicking(void) { struct Kicking *h = wickra_kicking_new(); if (!h) { printf("FAIL Kicking: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Kicking", &exp); int fails = 0; { const char *nm = wickra_kicking_name(h); if (!nm || strcmp(nm, "Kicking") != 0) { printf("FAIL Kicking: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kicking_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Kicking", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kicking_free(h); return fails; } static int check_KickingByLength(void) { struct KickingByLength *h = wickra_kicking_by_length_new(); if (!h) { printf("FAIL KickingByLength: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KickingByLength", &exp); int fails = 0; { const char *nm = wickra_kicking_by_length_name(h); if (!nm || strcmp(nm, "KickingByLength") != 0) { printf("FAIL KickingByLength: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kicking_by_length_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("KickingByLength", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kicking_by_length_free(h); return fails; } static int check_Kst(void) { struct Kst *h = wickra_kst_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28, (uintptr_t)35, (uintptr_t)42, (uintptr_t)56, (uintptr_t)63, (uintptr_t)70); if (!h) { printf("FAIL Kst: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Kst", &exp); int fails = 0; { const char *nm = wickra_kst_name(h); if (!nm || strcmp(nm, "KST") != 0) { printf("FAIL Kst: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraKstOutput out; if (wickra_kst_update(h, c, &out)) { got[gn++] = out.kst; got[gn++] = out.signal; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Kst", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kst_free(h); return fails; } static int check_Kurtosis(void) { struct Kurtosis *h = wickra_kurtosis_new((uintptr_t)14); if (!h) { printf("FAIL Kurtosis: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Kurtosis", &exp); int fails = 0; { const char *nm = wickra_kurtosis_name(h); if (!nm || strcmp(nm, "Kurtosis") != 0) { printf("FAIL Kurtosis: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kurtosis_update(h, c); fails += cmp_row("Kurtosis", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kurtosis_free(h); return fails; } static int check_Kvo(void) { struct Kvo *h = wickra_kvo_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Kvo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Kvo", &exp); int fails = 0; { const char *nm = wickra_kvo_name(h); if (!nm || strcmp(nm, "KVO") != 0) { printf("FAIL Kvo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kvo_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Kvo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kvo_free(h); return fails; } static int check_KylesLambda(void) { struct KylesLambda *h = wickra_kyles_lambda_new((uintptr_t)20); if (!h) { printf("FAIL KylesLambda: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_KylesLambda", &exp); int fails = 0; { const char *nm = wickra_kyles_lambda_name(h); if (!nm || strcmp(nm, "KylesLambda") != 0) { printf("FAIL KylesLambda: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_kyles_lambda_update(h, c, v, c >= o, (int64_t)i, (hi + lo) / 2.0); fails += cmp_row("KylesLambda", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_kyles_lambda_free(h); return fails; } static int check_LadderBottom(void) { struct LadderBottom *h = wickra_ladder_bottom_new(); if (!h) { printf("FAIL LadderBottom: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LadderBottom", &exp); int fails = 0; { const char *nm = wickra_ladder_bottom_name(h); if (!nm || strcmp(nm, "LadderBottom") != 0) { printf("FAIL LadderBottom: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ladder_bottom_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("LadderBottom", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ladder_bottom_free(h); return fails; } static int check_LaguerreRsi(void) { struct LaguerreRsi *h = wickra_laguerre_rsi_new(0.5); if (!h) { printf("FAIL LaguerreRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LaguerreRsi", &exp); int fails = 0; { const char *nm = wickra_laguerre_rsi_name(h); if (!nm || strcmp(nm, "LaguerreRSI") != 0) { printf("FAIL LaguerreRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_laguerre_rsi_update(h, c); fails += cmp_row("LaguerreRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_laguerre_rsi_free(h); return fails; } static int check_LeadLagCrossCorrelation(void) { struct LeadLagCrossCorrelation *h = wickra_lead_lag_cross_correlation_new((uintptr_t)20, (uintptr_t)10); if (!h) { printf("FAIL LeadLagCrossCorrelation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LeadLagCrossCorrelation", &exp); int fails = 0; { const char *nm = wickra_lead_lag_cross_correlation_name(h); if (!nm || strcmp(nm, "LeadLagCrossCorrelation") != 0) { printf("FAIL LeadLagCrossCorrelation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraLeadLagCrossCorrelationOutput out; if (wickra_lead_lag_cross_correlation_update(h, c, o, &out)) { got[gn++] = out.lag; got[gn++] = out.correlation; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("LeadLagCrossCorrelation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_lead_lag_cross_correlation_free(h); return fails; } static int check_LinRegAngle(void) { struct LinRegAngle *h = wickra_lin_reg_angle_new((uintptr_t)14); if (!h) { printf("FAIL LinRegAngle: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LinRegAngle", &exp); int fails = 0; { const char *nm = wickra_lin_reg_angle_name(h); if (!nm || strcmp(nm, "LinRegAngle") != 0) { printf("FAIL LinRegAngle: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_lin_reg_angle_update(h, c); fails += cmp_row("LinRegAngle", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_lin_reg_angle_free(h); return fails; } static int check_LinRegChannel(void) { struct LinRegChannel *h = wickra_lin_reg_channel_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL LinRegChannel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LinRegChannel", &exp); int fails = 0; { const char *nm = wickra_lin_reg_channel_name(h); if (!nm || strcmp(nm, "LinRegChannel") != 0) { printf("FAIL LinRegChannel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraLinRegChannelOutput out; if (wickra_lin_reg_channel_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("LinRegChannel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_lin_reg_channel_free(h); return fails; } static int check_LinRegIntercept(void) { struct LinRegIntercept *h = wickra_lin_reg_intercept_new((uintptr_t)14); if (!h) { printf("FAIL LinRegIntercept: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LinRegIntercept", &exp); int fails = 0; { const char *nm = wickra_lin_reg_intercept_name(h); if (!nm || strcmp(nm, "LINEARREG_INTERCEPT") != 0) { printf("FAIL LinRegIntercept: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_lin_reg_intercept_update(h, c); fails += cmp_row("LinRegIntercept", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_lin_reg_intercept_free(h); return fails; } static int check_LinRegSlope(void) { struct LinRegSlope *h = wickra_lin_reg_slope_new((uintptr_t)14); if (!h) { printf("FAIL LinRegSlope: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LinRegSlope", &exp); int fails = 0; { const char *nm = wickra_lin_reg_slope_name(h); if (!nm || strcmp(nm, "LinRegSlope") != 0) { printf("FAIL LinRegSlope: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_lin_reg_slope_update(h, c); fails += cmp_row("LinRegSlope", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_lin_reg_slope_free(h); return fails; } static int check_LinearRegression(void) { struct LinearRegression *h = wickra_linear_regression_new((uintptr_t)14); if (!h) { printf("FAIL LinearRegression: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LinearRegression", &exp); int fails = 0; { const char *nm = wickra_linear_regression_name(h); if (!nm || strcmp(nm, "LinearRegression") != 0) { printf("FAIL LinearRegression: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_linear_regression_update(h, c); fails += cmp_row("LinearRegression", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_linear_regression_free(h); return fails; } static int check_LiquidationFeatures(void) { struct LiquidationFeatures *h = wickra_liquidation_features_new(); if (!h) { printf("FAIL LiquidationFeatures: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LiquidationFeatures", &exp); int fails = 0; { const char *nm = wickra_liquidation_features_name(h); if (!nm || strcmp(nm, "LiquidationFeatures") != 0) { printf("FAIL LiquidationFeatures: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; struct WickraLiquidationFeaturesOutput out; if (wickra_liquidation_features_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i, &out)) { got[gn++] = out.long_; got[gn++] = out.short_; got[gn++] = out.net; got[gn++] = out.total; got[gn++] = out.imbalance; } else { for (int z = 0; z < 5; z++) got[gn++] = NANV; } fails += cmp_row("LiquidationFeatures", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_liquidation_features_free(h); return fails; } static int check_LogReturn(void) { struct LogReturn *h = wickra_log_return_new((uintptr_t)14); if (!h) { printf("FAIL LogReturn: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LogReturn", &exp); int fails = 0; { const char *nm = wickra_log_return_name(h); if (!nm || strcmp(nm, "LogReturn") != 0) { printf("FAIL LogReturn: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_log_return_update(h, c); fails += cmp_row("LogReturn", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_log_return_free(h); return fails; } static int check_LongLeggedDoji(void) { struct LongLeggedDoji *h = wickra_long_legged_doji_new(); if (!h) { printf("FAIL LongLeggedDoji: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LongLeggedDoji", &exp); int fails = 0; { const char *nm = wickra_long_legged_doji_name(h); if (!nm || strcmp(nm, "LongLeggedDoji") != 0) { printf("FAIL LongLeggedDoji: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_long_legged_doji_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("LongLeggedDoji", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_long_legged_doji_free(h); return fails; } static int check_LongLine(void) { struct LongLine *h = wickra_long_line_new(); if (!h) { printf("FAIL LongLine: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LongLine", &exp); int fails = 0; { const char *nm = wickra_long_line_name(h); if (!nm || strcmp(nm, "LongLine") != 0) { printf("FAIL LongLine: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_long_line_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("LongLine", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_long_line_free(h); return fails; } static int check_LongShortRatio(void) { struct LongShortRatio *h = wickra_long_short_ratio_new(); if (!h) { printf("FAIL LongShortRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_LongShortRatio", &exp); int fails = 0; { const char *nm = wickra_long_short_ratio_name(h); if (!nm || strcmp(nm, "LongShortRatio") != 0) { printf("FAIL LongShortRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_long_short_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("LongShortRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_long_short_ratio_free(h); return fails; } static int check_M2Measure(void) { struct M2Measure *h = wickra_m2_measure_new((uintptr_t)14, 2.0, 0.5); if (!h) { printf("FAIL M2Measure: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_M2Measure", &exp); int fails = 0; { const char *nm = wickra_m2_measure_name(h); if (!nm || strcmp(nm, "M2Measure") != 0) { printf("FAIL M2Measure: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_m2_measure_update(h, c); fails += cmp_row("M2Measure", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_m2_measure_free(h); return fails; } static int check_MaEnvelope(void) { struct MaEnvelope *h = wickra_ma_envelope_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL MaEnvelope: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MaEnvelope", &exp); int fails = 0; { const char *nm = wickra_ma_envelope_name(h); if (!nm || strcmp(nm, "MaEnvelope") != 0) { printf("FAIL MaEnvelope: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMaEnvelopeOutput out; if (wickra_ma_envelope_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("MaEnvelope", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ma_envelope_free(h); return fails; } static int check_MacdExt(void) { struct MacdExt *h = wickra_macd_ext_new((uintptr_t)12, (uint8_t)0, (uintptr_t)26, (uint8_t)0, (uintptr_t)9, (uint8_t)0); if (!h) { printf("FAIL MacdExt: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MacdExt", &exp); int fails = 0; { const char *nm = wickra_macd_ext_name(h); if (!nm || strcmp(nm, "MACDEXT") != 0) { printf("FAIL MacdExt: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMacdOutput out; if (wickra_macd_ext_update(h, c, &out)) { got[gn++] = out.macd; got[gn++] = out.signal; got[gn++] = out.histogram; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("MacdExt", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_macd_ext_free(h); return fails; } static int check_MacdFix(void) { struct MacdFix *h = wickra_macd_fix_new((uintptr_t)9); if (!h) { printf("FAIL MacdFix: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MacdFix", &exp); int fails = 0; { const char *nm = wickra_macd_fix_name(h); if (!nm || strcmp(nm, "MACDFIX") != 0) { printf("FAIL MacdFix: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMacdOutput out; if (wickra_macd_fix_update(h, c, &out)) { got[gn++] = out.macd; got[gn++] = out.signal; got[gn++] = out.histogram; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("MacdFix", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_macd_fix_free(h); return fails; } static int check_MacdHistogram(void) { struct MacdHistogram *h = wickra_macd_histogram_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL MacdHistogram: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MacdHistogram", &exp); int fails = 0; { const char *nm = wickra_macd_histogram_name(h); if (!nm || strcmp(nm, "MacdHistogram") != 0) { printf("FAIL MacdHistogram: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_macd_histogram_update(h, c); fails += cmp_row("MacdHistogram", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_macd_histogram_free(h); return fails; } static int check_MacdIndicator(void) { struct MacdIndicator *h = wickra_macd_indicator_new((uintptr_t)12, (uintptr_t)26, (uintptr_t)9); if (!h) { printf("FAIL MacdIndicator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MacdIndicator", &exp); int fails = 0; { const char *nm = wickra_macd_indicator_name(h); if (!nm || strcmp(nm, "MACD") != 0) { printf("FAIL MacdIndicator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMacdOutput out; if (wickra_macd_indicator_update(h, c, &out)) { got[gn++] = out.macd; got[gn++] = out.signal; got[gn++] = out.histogram; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("MacdIndicator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_macd_indicator_free(h); return fails; } static int check_Mama(void) { struct Mama *h = wickra_mama_new(0.5, 0.05); if (!h) { printf("FAIL Mama: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Mama", &exp); int fails = 0; { const char *nm = wickra_mama_name(h); if (!nm || strcmp(nm, "MAMA") != 0) { printf("FAIL Mama: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMamaOutput out; if (wickra_mama_update(h, c, &out)) { got[gn++] = out.mama; got[gn++] = out.fama; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Mama", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mama_free(h); return fails; } static int check_MarketFacilitationIndex(void) { struct MarketFacilitationIndex *h = wickra_market_facilitation_index_new(); if (!h) { printf("FAIL MarketFacilitationIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MarketFacilitationIndex", &exp); int fails = 0; { const char *nm = wickra_market_facilitation_index_name(h); if (!nm || strcmp(nm, "MarketFacilitationIndex") != 0) { printf("FAIL MarketFacilitationIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_market_facilitation_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MarketFacilitationIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_market_facilitation_index_free(h); return fails; } static int check_MartinRatio(void) { struct MartinRatio *h = wickra_martin_ratio_new((uintptr_t)14); if (!h) { printf("FAIL MartinRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MartinRatio", &exp); int fails = 0; { const char *nm = wickra_martin_ratio_name(h); if (!nm || strcmp(nm, "MartinRatio") != 0) { printf("FAIL MartinRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_martin_ratio_update(h, c); fails += cmp_row("MartinRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_martin_ratio_free(h); return fails; } static int check_Marubozu(void) { struct Marubozu *h = wickra_marubozu_new(); if (!h) { printf("FAIL Marubozu: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Marubozu", &exp); int fails = 0; { const char *nm = wickra_marubozu_name(h); if (!nm || strcmp(nm, "Marubozu") != 0) { printf("FAIL Marubozu: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_marubozu_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Marubozu", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_marubozu_free(h); return fails; } static int check_MassIndex(void) { struct MassIndex *h = wickra_mass_index_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL MassIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MassIndex", &exp); int fails = 0; { const char *nm = wickra_mass_index_name(h); if (!nm || strcmp(nm, "MassIndex") != 0) { printf("FAIL MassIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mass_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MassIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mass_index_free(h); return fails; } static int check_MatHold(void) { struct MatHold *h = wickra_mat_hold_new(); if (!h) { printf("FAIL MatHold: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MatHold", &exp); int fails = 0; { const char *nm = wickra_mat_hold_name(h); if (!nm || strcmp(nm, "MatHold") != 0) { printf("FAIL MatHold: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mat_hold_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MatHold", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mat_hold_free(h); return fails; } static int check_MatchingLow(void) { struct MatchingLow *h = wickra_matching_low_new(); if (!h) { printf("FAIL MatchingLow: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MatchingLow", &exp); int fails = 0; { const char *nm = wickra_matching_low_name(h); if (!nm || strcmp(nm, "MatchingLow") != 0) { printf("FAIL MatchingLow: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_matching_low_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MatchingLow", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_matching_low_free(h); return fails; } static int check_MaxDrawdown(void) { struct MaxDrawdown *h = wickra_max_drawdown_new((uintptr_t)14); if (!h) { printf("FAIL MaxDrawdown: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MaxDrawdown", &exp); int fails = 0; { const char *nm = wickra_max_drawdown_name(h); if (!nm || strcmp(nm, "MaxDrawdown") != 0) { printf("FAIL MaxDrawdown: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_max_drawdown_update(h, c); fails += cmp_row("MaxDrawdown", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_max_drawdown_free(h); return fails; } static int check_McClellanOscillator(void) { struct McClellanOscillator *h = wickra_mc_clellan_oscillator_new(); if (!h) { printf("FAIL McClellanOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_McClellanOscillator", &exp); int fails = 0; { const char *nm = wickra_mc_clellan_oscillator_name(h); if (!nm || strcmp(nm, "McClellanOscillator") != 0) { printf("FAIL McClellanOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_mc_clellan_oscillator_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("McClellanOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mc_clellan_oscillator_free(h); return fails; } static int check_McClellanSummationIndex(void) { struct McClellanSummationIndex *h = wickra_mc_clellan_summation_index_new(); if (!h) { printf("FAIL McClellanSummationIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_McClellanSummationIndex", &exp); int fails = 0; { const char *nm = wickra_mc_clellan_summation_index_name(h); if (!nm || strcmp(nm, "McClellanSummationIndex") != 0) { printf("FAIL McClellanSummationIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_mc_clellan_summation_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("McClellanSummationIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mc_clellan_summation_index_free(h); return fails; } static int check_McGinleyDynamic(void) { struct McGinleyDynamic *h = wickra_mc_ginley_dynamic_new((uintptr_t)14); if (!h) { printf("FAIL McGinleyDynamic: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_McGinleyDynamic", &exp); int fails = 0; { const char *nm = wickra_mc_ginley_dynamic_name(h); if (!nm || strcmp(nm, "McGinleyDynamic") != 0) { printf("FAIL McGinleyDynamic: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mc_ginley_dynamic_update(h, c); fails += cmp_row("McGinleyDynamic", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mc_ginley_dynamic_free(h); return fails; } static int check_MedianAbsoluteDeviation(void) { struct MedianAbsoluteDeviation *h = wickra_median_absolute_deviation_new((uintptr_t)14); if (!h) { printf("FAIL MedianAbsoluteDeviation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MedianAbsoluteDeviation", &exp); int fails = 0; { const char *nm = wickra_median_absolute_deviation_name(h); if (!nm || strcmp(nm, "MedianAbsoluteDeviation") != 0) { printf("FAIL MedianAbsoluteDeviation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_median_absolute_deviation_update(h, c); fails += cmp_row("MedianAbsoluteDeviation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_median_absolute_deviation_free(h); return fails; } static int check_MedianChannel(void) { struct MedianChannel *h = wickra_median_channel_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL MedianChannel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MedianChannel", &exp); int fails = 0; { const char *nm = wickra_median_channel_name(h); if (!nm || strcmp(nm, "MedianChannel") != 0) { printf("FAIL MedianChannel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMedianChannelOutput out; if (wickra_median_channel_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("MedianChannel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_median_channel_free(h); return fails; } static int check_MedianMa(void) { struct MedianMa *h = wickra_median_ma_new((uintptr_t)14); if (!h) { printf("FAIL MedianMa: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MedianMa", &exp); int fails = 0; { const char *nm = wickra_median_ma_name(h); if (!nm || strcmp(nm, "MedianMA") != 0) { printf("FAIL MedianMa: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_median_ma_update(h, c); fails += cmp_row("MedianMa", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_median_ma_free(h); return fails; } static int check_MedianPrice(void) { struct MedianPrice *h = wickra_median_price_new(); if (!h) { printf("FAIL MedianPrice: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MedianPrice", &exp); int fails = 0; { const char *nm = wickra_median_price_name(h); if (!nm || strcmp(nm, "MedianPrice") != 0) { printf("FAIL MedianPrice: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_median_price_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MedianPrice", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_median_price_free(h); return fails; } static int check_Mfi(void) { struct Mfi *h = wickra_mfi_new((uintptr_t)14); if (!h) { printf("FAIL Mfi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Mfi", &exp); int fails = 0; { const char *nm = wickra_mfi_name(h); if (!nm || strcmp(nm, "MFI") != 0) { printf("FAIL Mfi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mfi_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Mfi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mfi_free(h); return fails; } static int check_Microprice(void) { struct Microprice *h = wickra_microprice_new(); if (!h) { printf("FAIL Microprice: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Microprice", &exp); int fails = 0; { const char *nm = wickra_microprice_name(h); if (!nm || strcmp(nm, "Microprice") != 0) { printf("FAIL Microprice: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_microprice_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("Microprice", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_microprice_free(h); return fails; } static int check_MidPoint(void) { struct MidPoint *h = wickra_mid_point_new((uintptr_t)14); if (!h) { printf("FAIL MidPoint: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MidPoint", &exp); int fails = 0; { const char *nm = wickra_mid_point_name(h); if (!nm || strcmp(nm, "MIDPOINT") != 0) { printf("FAIL MidPoint: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mid_point_update(h, c); fails += cmp_row("MidPoint", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mid_point_free(h); return fails; } static int check_MidPrice(void) { struct MidPrice *h = wickra_mid_price_new((uintptr_t)14); if (!h) { printf("FAIL MidPrice: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MidPrice", &exp); int fails = 0; { const char *nm = wickra_mid_price_name(h); if (!nm || strcmp(nm, "MIDPRICE") != 0) { printf("FAIL MidPrice: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mid_price_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MidPrice", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mid_price_free(h); return fails; } static int check_MinusDi(void) { struct MinusDi *h = wickra_minus_di_new((uintptr_t)14); if (!h) { printf("FAIL MinusDi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MinusDi", &exp); int fails = 0; { const char *nm = wickra_minus_di_name(h); if (!nm || strcmp(nm, "MINUS_DI") != 0) { printf("FAIL MinusDi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_minus_di_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MinusDi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_minus_di_free(h); return fails; } static int check_MinusDm(void) { struct MinusDm *h = wickra_minus_dm_new((uintptr_t)14); if (!h) { printf("FAIL MinusDm: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MinusDm", &exp); int fails = 0; { const char *nm = wickra_minus_dm_name(h); if (!nm || strcmp(nm, "MINUS_DM") != 0) { printf("FAIL MinusDm: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_minus_dm_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MinusDm", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_minus_dm_free(h); return fails; } static int check_ModifiedMaStop(void) { struct ModifiedMaStop *h = wickra_modified_ma_stop_new((uintptr_t)14); if (!h) { printf("FAIL ModifiedMaStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ModifiedMaStop", &exp); int fails = 0; { const char *nm = wickra_modified_ma_stop_name(h); if (!nm || strcmp(nm, "ModifiedMaStop") != 0) { printf("FAIL ModifiedMaStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraModifiedMaStopOutput out; if (wickra_modified_ma_stop_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.value; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("ModifiedMaStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_modified_ma_stop_free(h); return fails; } static int check_Mom(void) { struct Mom *h = wickra_mom_new((uintptr_t)14); if (!h) { printf("FAIL Mom: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Mom", &exp); int fails = 0; { const char *nm = wickra_mom_name(h); if (!nm || strcmp(nm, "MOM") != 0) { printf("FAIL Mom: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_mom_update(h, c); fails += cmp_row("Mom", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_mom_free(h); return fails; } static int check_MorningDojiStar(void) { struct MorningDojiStar *h = wickra_morning_doji_star_new(); if (!h) { printf("FAIL MorningDojiStar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MorningDojiStar", &exp); int fails = 0; { const char *nm = wickra_morning_doji_star_name(h); if (!nm || strcmp(nm, "MorningDojiStar") != 0) { printf("FAIL MorningDojiStar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_morning_doji_star_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MorningDojiStar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_morning_doji_star_free(h); return fails; } static int check_MorningEveningStar(void) { struct MorningEveningStar *h = wickra_morning_evening_star_new(); if (!h) { printf("FAIL MorningEveningStar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MorningEveningStar", &exp); int fails = 0; { const char *nm = wickra_morning_evening_star_name(h); if (!nm || strcmp(nm, "MorningEveningStar") != 0) { printf("FAIL MorningEveningStar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_morning_evening_star_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("MorningEveningStar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_morning_evening_star_free(h); return fails; } static int check_MurreyMathLines(void) { struct MurreyMathLines *h = wickra_murrey_math_lines_new((uintptr_t)14); if (!h) { printf("FAIL MurreyMathLines: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_MurreyMathLines", &exp); int fails = 0; { const char *nm = wickra_murrey_math_lines_name(h); if (!nm || strcmp(nm, "MurreyMathLines") != 0) { printf("FAIL MurreyMathLines: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraMurreyMathLinesOutput out; if (wickra_murrey_math_lines_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.mm8_8; got[gn++] = out.mm7_8; got[gn++] = out.mm6_8; got[gn++] = out.mm5_8; got[gn++] = out.mm4_8; got[gn++] = out.mm3_8; got[gn++] = out.mm2_8; got[gn++] = out.mm1_8; got[gn++] = out.mm0_8; } else { for (int z = 0; z < 9; z++) got[gn++] = NANV; } fails += cmp_row("MurreyMathLines", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_murrey_math_lines_free(h); return fails; } static int check_NakedPoc(void) { struct NakedPoc *h = wickra_naked_poc_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL NakedPoc: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_NakedPoc", &exp); int fails = 0; { const char *nm = wickra_naked_poc_name(h); if (!nm || strcmp(nm, "NakedPoc") != 0) { printf("FAIL NakedPoc: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_naked_poc_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("NakedPoc", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_naked_poc_free(h); return fails; } static int check_Natr(void) { struct Natr *h = wickra_natr_new((uintptr_t)14); if (!h) { printf("FAIL Natr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Natr", &exp); int fails = 0; { const char *nm = wickra_natr_name(h); if (!nm || strcmp(nm, "NATR") != 0) { printf("FAIL Natr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_natr_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Natr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_natr_free(h); return fails; } static int check_NewHighsNewLows(void) { struct NewHighsNewLows *h = wickra_new_highs_new_lows_new(); if (!h) { printf("FAIL NewHighsNewLows: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_NewHighsNewLows", &exp); int fails = 0; { const char *nm = wickra_new_highs_new_lows_name(h); if (!nm || strcmp(nm, "NewHighsNewLows") != 0) { printf("FAIL NewHighsNewLows: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_new_highs_new_lows_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("NewHighsNewLows", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_new_highs_new_lows_free(h); return fails; } static int check_NewPriceLines(void) { struct NewPriceLines *h = wickra_new_price_lines_new((uintptr_t)14); if (!h) { printf("FAIL NewPriceLines: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_NewPriceLines", &exp); int fails = 0; { const char *nm = wickra_new_price_lines_name(h); if (!nm || strcmp(nm, "NewPriceLines") != 0) { printf("FAIL NewPriceLines: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_new_price_lines_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("NewPriceLines", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_new_price_lines_free(h); return fails; } static int check_Nrtr(void) { struct Nrtr *h = wickra_nrtr_new(2.0); if (!h) { printf("FAIL Nrtr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Nrtr", &exp); int fails = 0; { const char *nm = wickra_nrtr_name(h); if (!nm || strcmp(nm, "Nrtr") != 0) { printf("FAIL Nrtr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraNrtrOutput out; if (wickra_nrtr_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.value; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Nrtr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_nrtr_free(h); return fails; } static int check_Nvi(void) { struct Nvi *h = wickra_nvi_new(); if (!h) { printf("FAIL Nvi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Nvi", &exp); int fails = 0; { const char *nm = wickra_nvi_name(h); if (!nm || strcmp(nm, "NVI") != 0) { printf("FAIL Nvi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_nvi_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Nvi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_nvi_free(h); return fails; } static int check_OIPriceDivergence(void) { struct OIPriceDivergence *h = wickra_oi_price_divergence_new((uintptr_t)20); if (!h) { printf("FAIL OIPriceDivergence: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OIPriceDivergence", &exp); int fails = 0; { const char *nm = wickra_oi_price_divergence_name(h); if (!nm || strcmp(nm, "OIPriceDivergence") != 0) { printf("FAIL OIPriceDivergence: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_oi_price_divergence_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("OIPriceDivergence", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_oi_price_divergence_free(h); return fails; } static int check_OIWeighted(void) { struct OIWeighted *h = wickra_oi_weighted_new(); if (!h) { printf("FAIL OIWeighted: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OIWeighted", &exp); int fails = 0; { const char *nm = wickra_oi_weighted_name(h); if (!nm || strcmp(nm, "OIWeighted") != 0) { printf("FAIL OIWeighted: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_oi_weighted_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("OIWeighted", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_oi_weighted_free(h); return fails; } static int check_Obv(void) { struct Obv *h = wickra_obv_new(); if (!h) { printf("FAIL Obv: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Obv", &exp); int fails = 0; { const char *nm = wickra_obv_name(h); if (!nm || strcmp(nm, "OBV") != 0) { printf("FAIL Obv: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_obv_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Obv", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_obv_free(h); return fails; } static int check_OiToVolumeRatio(void) { struct OiToVolumeRatio *h = wickra_oi_to_volume_ratio_new(); if (!h) { printf("FAIL OiToVolumeRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OiToVolumeRatio", &exp); int fails = 0; { const char *nm = wickra_oi_to_volume_ratio_name(h); if (!nm || strcmp(nm, "OiToVolumeRatio") != 0) { printf("FAIL OiToVolumeRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_oi_to_volume_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("OiToVolumeRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_oi_to_volume_ratio_free(h); return fails; } static int check_OmegaRatio(void) { struct OmegaRatio *h = wickra_omega_ratio_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL OmegaRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OmegaRatio", &exp); int fails = 0; { const char *nm = wickra_omega_ratio_name(h); if (!nm || strcmp(nm, "OmegaRatio") != 0) { printf("FAIL OmegaRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_omega_ratio_update(h, c); fails += cmp_row("OmegaRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_omega_ratio_free(h); return fails; } static int check_OnNeck(void) { struct OnNeck *h = wickra_on_neck_new(); if (!h) { printf("FAIL OnNeck: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OnNeck", &exp); int fails = 0; { const char *nm = wickra_on_neck_name(h); if (!nm || strcmp(nm, "OnNeck") != 0) { printf("FAIL OnNeck: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_on_neck_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("OnNeck", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_on_neck_free(h); return fails; } static int check_OpenInterestDelta(void) { struct OpenInterestDelta *h = wickra_open_interest_delta_new(); if (!h) { printf("FAIL OpenInterestDelta: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OpenInterestDelta", &exp); int fails = 0; { const char *nm = wickra_open_interest_delta_name(h); if (!nm || strcmp(nm, "OpenInterestDelta") != 0) { printf("FAIL OpenInterestDelta: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_open_interest_delta_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("OpenInterestDelta", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_open_interest_delta_free(h); return fails; } static int check_OpenInterestMomentum(void) { struct OpenInterestMomentum *h = wickra_open_interest_momentum_new((uintptr_t)10); if (!h) { printf("FAIL OpenInterestMomentum: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OpenInterestMomentum", &exp); int fails = 0; { const char *nm = wickra_open_interest_momentum_name(h); if (!nm || strcmp(nm, "OpenInterestMomentum") != 0) { printf("FAIL OpenInterestMomentum: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_open_interest_momentum_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("OpenInterestMomentum", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_open_interest_momentum_free(h); return fails; } static int check_OpeningMarubozu(void) { struct OpeningMarubozu *h = wickra_opening_marubozu_new(); if (!h) { printf("FAIL OpeningMarubozu: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OpeningMarubozu", &exp); int fails = 0; { const char *nm = wickra_opening_marubozu_name(h); if (!nm || strcmp(nm, "OpeningMarubozu") != 0) { printf("FAIL OpeningMarubozu: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_opening_marubozu_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("OpeningMarubozu", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_opening_marubozu_free(h); return fails; } static int check_OpeningRange(void) { struct OpeningRange *h = wickra_opening_range_new((uintptr_t)14); if (!h) { printf("FAIL OpeningRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OpeningRange", &exp); int fails = 0; { const char *nm = wickra_opening_range_name(h); if (!nm || strcmp(nm, "OpeningRange") != 0) { printf("FAIL OpeningRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraOpeningRangeOutput out; if (wickra_opening_range_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.high; got[gn++] = out.low; got[gn++] = out.breakout_distance; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("OpeningRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_opening_range_free(h); return fails; } static int check_OrderBookImbalanceFull(void) { struct OrderBookImbalanceFull *h = wickra_order_book_imbalance_full_new(); if (!h) { printf("FAIL OrderBookImbalanceFull: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OrderBookImbalanceFull", &exp); int fails = 0; { const char *nm = wickra_order_book_imbalance_full_name(h); if (!nm || strcmp(nm, "OrderBookImbalanceFull") != 0) { printf("FAIL OrderBookImbalanceFull: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_order_book_imbalance_full_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("OrderBookImbalanceFull", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_order_book_imbalance_full_free(h); return fails; } static int check_OrderBookImbalanceTop1(void) { struct OrderBookImbalanceTop1 *h = wickra_order_book_imbalance_top1_new(); if (!h) { printf("FAIL OrderBookImbalanceTop1: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OrderBookImbalanceTop1", &exp); int fails = 0; { const char *nm = wickra_order_book_imbalance_top1_name(h); if (!nm || strcmp(nm, "OrderBookImbalanceTop1") != 0) { printf("FAIL OrderBookImbalanceTop1: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_order_book_imbalance_top1_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("OrderBookImbalanceTop1", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_order_book_imbalance_top1_free(h); return fails; } static int check_OrderBookImbalanceTopN(void) { struct OrderBookImbalanceTopN *h = wickra_order_book_imbalance_top_n_new((uintptr_t)5); if (!h) { printf("FAIL OrderBookImbalanceTopN: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OrderBookImbalanceTopN", &exp); int fails = 0; { const char *nm = wickra_order_book_imbalance_top_n_name(h); if (!nm || strcmp(nm, "OrderBookImbalanceTopN") != 0) { printf("FAIL OrderBookImbalanceTopN: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_order_book_imbalance_top_n_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("OrderBookImbalanceTopN", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_order_book_imbalance_top_n_free(h); return fails; } static int check_OrderFlowImbalance(void) { struct OrderFlowImbalance *h = wickra_order_flow_imbalance_new((uintptr_t)20); if (!h) { printf("FAIL OrderFlowImbalance: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OrderFlowImbalance", &exp); int fails = 0; { const char *nm = wickra_order_flow_imbalance_name(h); if (!nm || strcmp(nm, "OrderFlowImbalance") != 0) { printf("FAIL OrderFlowImbalance: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_order_flow_imbalance_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("OrderFlowImbalance", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_order_flow_imbalance_free(h); return fails; } static int check_OuHalfLife(void) { struct OuHalfLife *h = wickra_ou_half_life_new((uintptr_t)14); if (!h) { printf("FAIL OuHalfLife: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OuHalfLife", &exp); int fails = 0; { const char *nm = wickra_ou_half_life_name(h); if (!nm || strcmp(nm, "OuHalfLife") != 0) { printf("FAIL OuHalfLife: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ou_half_life_update(h, c, o); fails += cmp_row("OuHalfLife", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ou_half_life_free(h); return fails; } static int check_OvernightGap(void) { struct OvernightGap *h = wickra_overnight_gap_new((int32_t)0); if (!h) { printf("FAIL OvernightGap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OvernightGap", &exp); int fails = 0; { const char *nm = wickra_overnight_gap_name(h); if (!nm || strcmp(nm, "OvernightGap") != 0) { printf("FAIL OvernightGap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_overnight_gap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("OvernightGap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_overnight_gap_free(h); return fails; } static int check_OvernightIntradayReturn(void) { struct OvernightIntradayReturn *h = wickra_overnight_intraday_return_new((int32_t)14); if (!h) { printf("FAIL OvernightIntradayReturn: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_OvernightIntradayReturn", &exp); int fails = 0; { const char *nm = wickra_overnight_intraday_return_name(h); if (!nm || strcmp(nm, "OvernightIntradayReturn") != 0) { printf("FAIL OvernightIntradayReturn: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraOvernightIntradayReturnOutput out; if (wickra_overnight_intraday_return_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.overnight; got[gn++] = out.intraday; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("OvernightIntradayReturn", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_overnight_intraday_return_free(h); return fails; } static int check_PainIndex(void) { struct PainIndex *h = wickra_pain_index_new((uintptr_t)14); if (!h) { printf("FAIL PainIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PainIndex", &exp); int fails = 0; { const char *nm = wickra_pain_index_name(h); if (!nm || strcmp(nm, "PainIndex") != 0) { printf("FAIL PainIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pain_index_update(h, c); fails += cmp_row("PainIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pain_index_free(h); return fails; } static int check_PairSpreadZScore(void) { struct PairSpreadZScore *h = wickra_pair_spread_z_score_new((uintptr_t)20, (uintptr_t)20); if (!h) { printf("FAIL PairSpreadZScore: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PairSpreadZScore", &exp); int fails = 0; { const char *nm = wickra_pair_spread_z_score_name(h); if (!nm || strcmp(nm, "PairSpreadZScore") != 0) { printf("FAIL PairSpreadZScore: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pair_spread_z_score_update(h, c, o); fails += cmp_row("PairSpreadZScore", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pair_spread_z_score_free(h); return fails; } static int check_PairwiseBeta(void) { struct PairwiseBeta *h = wickra_pairwise_beta_new((uintptr_t)14); if (!h) { printf("FAIL PairwiseBeta: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PairwiseBeta", &exp); int fails = 0; { const char *nm = wickra_pairwise_beta_name(h); if (!nm || strcmp(nm, "PairwiseBeta") != 0) { printf("FAIL PairwiseBeta: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pairwise_beta_update(h, c, o); fails += cmp_row("PairwiseBeta", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pairwise_beta_free(h); return fails; } static int check_ParkinsonVolatility(void) { struct ParkinsonVolatility *h = wickra_parkinson_volatility_new((uintptr_t)20, (uintptr_t)252); if (!h) { printf("FAIL ParkinsonVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ParkinsonVolatility", &exp); int fails = 0; { const char *nm = wickra_parkinson_volatility_name(h); if (!nm || strcmp(nm, "ParkinsonVolatility") != 0) { printf("FAIL ParkinsonVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_parkinson_volatility_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ParkinsonVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_parkinson_volatility_free(h); return fails; } static int check_PearsonCorrelation(void) { struct PearsonCorrelation *h = wickra_pearson_correlation_new((uintptr_t)14); if (!h) { printf("FAIL PearsonCorrelation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PearsonCorrelation", &exp); int fails = 0; { const char *nm = wickra_pearson_correlation_name(h); if (!nm || strcmp(nm, "PearsonCorrelation") != 0) { printf("FAIL PearsonCorrelation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pearson_correlation_update(h, c, o); fails += cmp_row("PearsonCorrelation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pearson_correlation_free(h); return fails; } static int check_PercentAboveMa(void) { struct PercentAboveMa *h = wickra_percent_above_ma_new(); if (!h) { printf("FAIL PercentAboveMa: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PercentAboveMa", &exp); int fails = 0; { const char *nm = wickra_percent_above_ma_name(h); if (!nm || strcmp(nm, "PercentAboveMa") != 0) { printf("FAIL PercentAboveMa: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_percent_above_ma_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("PercentAboveMa", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_percent_above_ma_free(h); return fails; } static int check_PercentB(void) { struct PercentB *h = wickra_percent_b_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL PercentB: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PercentB", &exp); int fails = 0; { const char *nm = wickra_percent_b_name(h); if (!nm || strcmp(nm, "PercentB") != 0) { printf("FAIL PercentB: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_percent_b_update(h, c); fails += cmp_row("PercentB", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_percent_b_free(h); return fails; } static int check_PercentageTrailingStop(void) { struct PercentageTrailingStop *h = wickra_percentage_trailing_stop_new(2.0); if (!h) { printf("FAIL PercentageTrailingStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PercentageTrailingStop", &exp); int fails = 0; { const char *nm = wickra_percentage_trailing_stop_name(h); if (!nm || strcmp(nm, "PercentageTrailingStop") != 0) { printf("FAIL PercentageTrailingStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_percentage_trailing_stop_update(h, c); fails += cmp_row("PercentageTrailingStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_percentage_trailing_stop_free(h); return fails; } static int check_PerpetualPremiumIndex(void) { struct PerpetualPremiumIndex *h = wickra_perpetual_premium_index_new(); if (!h) { printf("FAIL PerpetualPremiumIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PerpetualPremiumIndex", &exp); int fails = 0; { const char *nm = wickra_perpetual_premium_index_name(h); if (!nm || strcmp(nm, "PerpetualPremiumIndex") != 0) { printf("FAIL PerpetualPremiumIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_perpetual_premium_index_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("PerpetualPremiumIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_perpetual_premium_index_free(h); return fails; } static int check_Pgo(void) { struct Pgo *h = wickra_pgo_new((uintptr_t)14); if (!h) { printf("FAIL Pgo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Pgo", &exp); int fails = 0; { const char *nm = wickra_pgo_name(h); if (!nm || strcmp(nm, "PGO") != 0) { printf("FAIL Pgo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pgo_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Pgo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pgo_free(h); return fails; } static int check_PiercingDarkCloud(void) { struct PiercingDarkCloud *h = wickra_piercing_dark_cloud_new(); if (!h) { printf("FAIL PiercingDarkCloud: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PiercingDarkCloud", &exp); int fails = 0; { const char *nm = wickra_piercing_dark_cloud_name(h); if (!nm || strcmp(nm, "PiercingDarkCloud") != 0) { printf("FAIL PiercingDarkCloud: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_piercing_dark_cloud_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("PiercingDarkCloud", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_piercing_dark_cloud_free(h); return fails; } static int check_Pin(void) { struct Pin *h = wickra_pin_new((uintptr_t)20); if (!h) { printf("FAIL Pin: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Pin", &exp); int fails = 0; { const char *nm = wickra_pin_name(h); if (!nm || strcmp(nm, "PIN") != 0) { printf("FAIL Pin: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pin_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("Pin", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pin_free(h); return fails; } static int check_PivotReversal(void) { struct PivotReversal *h = wickra_pivot_reversal_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL PivotReversal: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PivotReversal", &exp); int fails = 0; { const char *nm = wickra_pivot_reversal_name(h); if (!nm || strcmp(nm, "PivotReversal") != 0) { printf("FAIL PivotReversal: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pivot_reversal_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("PivotReversal", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pivot_reversal_free(h); return fails; } static int check_PlusDi(void) { struct PlusDi *h = wickra_plus_di_new((uintptr_t)14); if (!h) { printf("FAIL PlusDi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PlusDi", &exp); int fails = 0; { const char *nm = wickra_plus_di_name(h); if (!nm || strcmp(nm, "PLUS_DI") != 0) { printf("FAIL PlusDi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_plus_di_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("PlusDi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_plus_di_free(h); return fails; } static int check_PlusDm(void) { struct PlusDm *h = wickra_plus_dm_new((uintptr_t)14); if (!h) { printf("FAIL PlusDm: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PlusDm", &exp); int fails = 0; { const char *nm = wickra_plus_dm_name(h); if (!nm || strcmp(nm, "PLUS_DM") != 0) { printf("FAIL PlusDm: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_plus_dm_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("PlusDm", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_plus_dm_free(h); return fails; } static int check_Pmo(void) { struct Pmo *h = wickra_pmo_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Pmo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Pmo", &exp); int fails = 0; { const char *nm = wickra_pmo_name(h); if (!nm || strcmp(nm, "PMO") != 0) { printf("FAIL Pmo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pmo_update(h, c); fails += cmp_row("Pmo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pmo_free(h); return fails; } static int check_PointAndFigureBars(void) { struct PointAndFigureBars *h = wickra_point_and_figure_bars_new(2.0, (uintptr_t)3); if (!h) { printf("FAIL PointAndFigureBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PointAndFigureBars", &exp); int fails = 0; { const char *nm = wickra_point_and_figure_bars_name(h); if (!nm || strcmp(nm, "PointAndFigureBars") != 0) { printf("FAIL PointAndFigureBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraPnfColumn bbuf[256]; uintptr_t k = wickra_point_and_figure_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].direction; got[gn++] = (double)bbuf[b].high; got[gn++] = (double)bbuf[b].low; } fails += cmp_row("PointAndFigureBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_point_and_figure_bars_free(h); return fails; } static int check_PolarizedFractalEfficiency(void) { struct PolarizedFractalEfficiency *h = wickra_polarized_fractal_efficiency_new((uintptr_t)10, (uintptr_t)5); if (!h) { printf("FAIL PolarizedFractalEfficiency: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PolarizedFractalEfficiency", &exp); int fails = 0; { const char *nm = wickra_polarized_fractal_efficiency_name(h); if (!nm || strcmp(nm, "PolarizedFractalEfficiency") != 0) { printf("FAIL PolarizedFractalEfficiency: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_polarized_fractal_efficiency_update(h, c); fails += cmp_row("PolarizedFractalEfficiency", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_polarized_fractal_efficiency_free(h); return fails; } static int check_Ppo(void) { struct Ppo *h = wickra_ppo_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Ppo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Ppo", &exp); int fails = 0; { const char *nm = wickra_ppo_name(h); if (!nm || strcmp(nm, "PPO") != 0) { printf("FAIL Ppo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ppo_update(h, c); fails += cmp_row("Ppo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ppo_free(h); return fails; } static int check_PpoHistogram(void) { struct PpoHistogram *h = wickra_ppo_histogram_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL PpoHistogram: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_PpoHistogram", &exp); int fails = 0; { const char *nm = wickra_ppo_histogram_name(h); if (!nm || strcmp(nm, "PpoHistogram") != 0) { printf("FAIL PpoHistogram: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ppo_histogram_update(h, c); fails += cmp_row("PpoHistogram", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ppo_histogram_free(h); return fails; } static int check_ProfileShape(void) { struct ProfileShape *h = wickra_profile_shape_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL ProfileShape: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ProfileShape", &exp); int fails = 0; { const char *nm = wickra_profile_shape_name(h); if (!nm || strcmp(nm, "ProfileShape") != 0) { printf("FAIL ProfileShape: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_profile_shape_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ProfileShape", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_profile_shape_free(h); return fails; } static int check_ProfitFactor(void) { struct ProfitFactor *h = wickra_profit_factor_new((uintptr_t)14); if (!h) { printf("FAIL ProfitFactor: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ProfitFactor", &exp); int fails = 0; { const char *nm = wickra_profit_factor_name(h); if (!nm || strcmp(nm, "ProfitFactor") != 0) { printf("FAIL ProfitFactor: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_profit_factor_update(h, c); fails += cmp_row("ProfitFactor", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_profit_factor_free(h); return fails; } static int check_ProjectionBands(void) { struct ProjectionBands *h = wickra_projection_bands_new((uintptr_t)14); if (!h) { printf("FAIL ProjectionBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ProjectionBands", &exp); int fails = 0; { const char *nm = wickra_projection_bands_name(h); if (!nm || strcmp(nm, "ProjectionBands") != 0) { printf("FAIL ProjectionBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraProjectionBandsOutput out; if (wickra_projection_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("ProjectionBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_projection_bands_free(h); return fails; } static int check_ProjectionOscillator(void) { struct ProjectionOscillator *h = wickra_projection_oscillator_new((uintptr_t)14); if (!h) { printf("FAIL ProjectionOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ProjectionOscillator", &exp); int fails = 0; { const char *nm = wickra_projection_oscillator_name(h); if (!nm || strcmp(nm, "ProjectionOscillator") != 0) { printf("FAIL ProjectionOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_projection_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ProjectionOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_projection_oscillator_free(h); return fails; } static int check_Psar(void) { struct Psar *h = wickra_psar_new(0.02, 0.02, 0.2); if (!h) { printf("FAIL Psar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Psar", &exp); int fails = 0; { const char *nm = wickra_psar_name(h); if (!nm || strcmp(nm, "PSAR") != 0) { printf("FAIL Psar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_psar_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Psar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_psar_free(h); return fails; } static int check_Pvi(void) { struct Pvi *h = wickra_pvi_new(); if (!h) { printf("FAIL Pvi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Pvi", &exp); int fails = 0; { const char *nm = wickra_pvi_name(h); if (!nm || strcmp(nm, "PVI") != 0) { printf("FAIL Pvi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_pvi_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Pvi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_pvi_free(h); return fails; } static int check_Qqe(void) { struct Qqe *h = wickra_qqe_new((uintptr_t)3, (uintptr_t)7, 2.0); if (!h) { printf("FAIL Qqe: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Qqe", &exp); int fails = 0; { const char *nm = wickra_qqe_name(h); if (!nm || strcmp(nm, "QQE") != 0) { printf("FAIL Qqe: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraQqeOutput out; if (wickra_qqe_update(h, c, &out)) { got[gn++] = out.rsi_ma; got[gn++] = out.trailing_line; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Qqe", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_qqe_free(h); return fails; } static int check_Qstick(void) { struct Qstick *h = wickra_qstick_new((uintptr_t)14); if (!h) { printf("FAIL Qstick: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Qstick", &exp); int fails = 0; { const char *nm = wickra_qstick_name(h); if (!nm || strcmp(nm, "Qstick") != 0) { printf("FAIL Qstick: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_qstick_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Qstick", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_qstick_free(h); return fails; } static int check_QuartileBands(void) { struct QuartileBands *h = wickra_quartile_bands_new((uintptr_t)14); if (!h) { printf("FAIL QuartileBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_QuartileBands", &exp); int fails = 0; { const char *nm = wickra_quartile_bands_name(h); if (!nm || strcmp(nm, "QuartileBands") != 0) { printf("FAIL QuartileBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraQuartileBandsOutput out; if (wickra_quartile_bands_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("QuartileBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_quartile_bands_free(h); return fails; } static int check_QuotedSpread(void) { struct QuotedSpread *h = wickra_quoted_spread_new(); if (!h) { printf("FAIL QuotedSpread: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_QuotedSpread", &exp); int fails = 0; { const char *nm = wickra_quoted_spread_name(h); if (!nm || strcmp(nm, "QuotedSpread") != 0) { printf("FAIL QuotedSpread: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double bp[5], bs[5], ap[5], asz[5]; for (int k = 0; k < 5; k++) { double kf = k + 1; bp[k] = c - 0.1*kf; bs[k] = v/kf; ap[k] = c + 0.1*kf; asz[k] = v*0.9/kf; } got[gn++] = wickra_quoted_spread_update(h, bp, bs, 5, ap, asz, 5); fails += cmp_row("QuotedSpread", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_quoted_spread_free(h); return fails; } static int check_RSquared(void) { struct RSquared *h = wickra_r_squared_new((uintptr_t)14); if (!h) { printf("FAIL RSquared: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RSquared", &exp); int fails = 0; { const char *nm = wickra_r_squared_name(h); if (!nm || strcmp(nm, "RSquared") != 0) { printf("FAIL RSquared: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_r_squared_update(h, c); fails += cmp_row("RSquared", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_r_squared_free(h); return fails; } static int check_RangeBars(void) { struct RangeBars *h = wickra_range_bars_new(2.0); if (!h) { printf("FAIL RangeBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RangeBars", &exp); int fails = 0; { const char *nm = wickra_range_bars_name(h); if (!nm || strcmp(nm, "RangeBars") != 0) { printf("FAIL RangeBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraRangeBar bbuf[256]; uintptr_t k = wickra_range_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].direction; } fails += cmp_row("RangeBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_range_bars_free(h); return fails; } static int check_RealizedSpread(void) { struct RealizedSpread *h = wickra_realized_spread_new((uintptr_t)20); if (!h) { printf("FAIL RealizedSpread: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RealizedSpread", &exp); int fails = 0; { const char *nm = wickra_realized_spread_name(h); if (!nm || strcmp(nm, "RealizedSpread") != 0) { printf("FAIL RealizedSpread: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_realized_spread_update(h, c, v, c >= o, (int64_t)i, (hi + lo) / 2.0); fails += cmp_row("RealizedSpread", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_realized_spread_free(h); return fails; } static int check_RealizedVolatility(void) { struct RealizedVolatility *h = wickra_realized_volatility_new((uintptr_t)14); if (!h) { printf("FAIL RealizedVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RealizedVolatility", &exp); int fails = 0; { const char *nm = wickra_realized_volatility_name(h); if (!nm || strcmp(nm, "RealizedVolatility") != 0) { printf("FAIL RealizedVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_realized_volatility_update(h, c); fails += cmp_row("RealizedVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_realized_volatility_free(h); return fails; } static int check_RecoveryFactor(void) { struct RecoveryFactor *h = wickra_recovery_factor_new(); if (!h) { printf("FAIL RecoveryFactor: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RecoveryFactor", &exp); int fails = 0; { const char *nm = wickra_recovery_factor_name(h); if (!nm || strcmp(nm, "RecoveryFactor") != 0) { printf("FAIL RecoveryFactor: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_recovery_factor_update(h, c); fails += cmp_row("RecoveryFactor", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_recovery_factor_free(h); return fails; } static int check_RectangleRange(void) { struct RectangleRange *h = wickra_rectangle_range_new(); if (!h) { printf("FAIL RectangleRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RectangleRange", &exp); int fails = 0; { const char *nm = wickra_rectangle_range_name(h); if (!nm || strcmp(nm, "RectangleRange") != 0) { printf("FAIL RectangleRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rectangle_range_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("RectangleRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rectangle_range_free(h); return fails; } static int check_Reflex(void) { struct Reflex *h = wickra_reflex_new((uintptr_t)14); if (!h) { printf("FAIL Reflex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Reflex", &exp); int fails = 0; { const char *nm = wickra_reflex_name(h); if (!nm || strcmp(nm, "Reflex") != 0) { printf("FAIL Reflex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_reflex_update(h, c); fails += cmp_row("Reflex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_reflex_free(h); return fails; } static int check_RegimeLabel(void) { struct RegimeLabel *h = wickra_regime_label_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL RegimeLabel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RegimeLabel", &exp); int fails = 0; { const char *nm = wickra_regime_label_name(h); if (!nm || strcmp(nm, "RegimeLabel") != 0) { printf("FAIL RegimeLabel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_regime_label_update(h, c); fails += cmp_row("RegimeLabel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_regime_label_free(h); return fails; } static int check_RelativeStrengthAB(void) { struct RelativeStrengthAB *h = wickra_relative_strength_ab_new((uintptr_t)14, (uintptr_t)14); if (!h) { printf("FAIL RelativeStrengthAB: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RelativeStrengthAB", &exp); int fails = 0; { const char *nm = wickra_relative_strength_ab_name(h); if (!nm || strcmp(nm, "RelativeStrengthAB") != 0) { printf("FAIL RelativeStrengthAB: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraRelativeStrengthOutput out; if (wickra_relative_strength_ab_update(h, c, o, &out)) { got[gn++] = out.ratio; got[gn++] = out.ratio_ma; got[gn++] = out.ratio_rsi; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("RelativeStrengthAB", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_relative_strength_ab_free(h); return fails; } static int check_RenkoBars(void) { struct RenkoBars *h = wickra_renko_bars_new(2.0); if (!h) { printf("FAIL RenkoBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RenkoBars", &exp); int fails = 0; { const char *nm = wickra_renko_bars_name(h); if (!nm || strcmp(nm, "RenkoBars") != 0) { printf("FAIL RenkoBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraRenkoBrick bbuf[256]; uintptr_t k = wickra_renko_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].direction; } fails += cmp_row("RenkoBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_renko_bars_free(h); return fails; } static int check_RenkoTrailingStop(void) { struct RenkoTrailingStop *h = wickra_renko_trailing_stop_new(2.0); if (!h) { printf("FAIL RenkoTrailingStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RenkoTrailingStop", &exp); int fails = 0; { const char *nm = wickra_renko_trailing_stop_name(h); if (!nm || strcmp(nm, "RenkoTrailingStop") != 0) { printf("FAIL RenkoTrailingStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_renko_trailing_stop_update(h, c); fails += cmp_row("RenkoTrailingStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_renko_trailing_stop_free(h); return fails; } static int check_RickshawMan(void) { struct RickshawMan *h = wickra_rickshaw_man_new(); if (!h) { printf("FAIL RickshawMan: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RickshawMan", &exp); int fails = 0; { const char *nm = wickra_rickshaw_man_name(h); if (!nm || strcmp(nm, "RickshawMan") != 0) { printf("FAIL RickshawMan: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rickshaw_man_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("RickshawMan", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rickshaw_man_free(h); return fails; } static int check_RisingThreeMethods(void) { struct RisingThreeMethods *h = wickra_rising_three_methods_new(); if (!h) { printf("FAIL RisingThreeMethods: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RisingThreeMethods", &exp); int fails = 0; { const char *nm = wickra_rising_three_methods_name(h); if (!nm || strcmp(nm, "RisingThreeMethods") != 0) { printf("FAIL RisingThreeMethods: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rising_three_methods_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("RisingThreeMethods", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rising_three_methods_free(h); return fails; } static int check_Rmi(void) { struct Rmi *h = wickra_rmi_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Rmi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rmi", &exp); int fails = 0; { const char *nm = wickra_rmi_name(h); if (!nm || strcmp(nm, "RMI") != 0) { printf("FAIL Rmi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rmi_update(h, c); fails += cmp_row("Rmi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rmi_free(h); return fails; } static int check_Roc(void) { struct Roc *h = wickra_roc_new((uintptr_t)14); if (!h) { printf("FAIL Roc: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Roc", &exp); int fails = 0; { const char *nm = wickra_roc_name(h); if (!nm || strcmp(nm, "ROC") != 0) { printf("FAIL Roc: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_roc_update(h, c); fails += cmp_row("Roc", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_roc_free(h); return fails; } static int check_Rocp(void) { struct Rocp *h = wickra_rocp_new((uintptr_t)14); if (!h) { printf("FAIL Rocp: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rocp", &exp); int fails = 0; { const char *nm = wickra_rocp_name(h); if (!nm || strcmp(nm, "ROCP") != 0) { printf("FAIL Rocp: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rocp_update(h, c); fails += cmp_row("Rocp", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rocp_free(h); return fails; } static int check_Rocr(void) { struct Rocr *h = wickra_rocr_new((uintptr_t)14); if (!h) { printf("FAIL Rocr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rocr", &exp); int fails = 0; { const char *nm = wickra_rocr_name(h); if (!nm || strcmp(nm, "ROCR") != 0) { printf("FAIL Rocr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rocr_update(h, c); fails += cmp_row("Rocr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rocr_free(h); return fails; } static int check_Rocr100(void) { struct Rocr100 *h = wickra_rocr100_new((uintptr_t)14); if (!h) { printf("FAIL Rocr100: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rocr100", &exp); int fails = 0; { const char *nm = wickra_rocr100_name(h); if (!nm || strcmp(nm, "ROCR100") != 0) { printf("FAIL Rocr100: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rocr100_update(h, c); fails += cmp_row("Rocr100", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rocr100_free(h); return fails; } static int check_RogersSatchellVolatility(void) { struct RogersSatchellVolatility *h = wickra_rogers_satchell_volatility_new((uintptr_t)20, (uintptr_t)252); if (!h) { printf("FAIL RogersSatchellVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RogersSatchellVolatility", &exp); int fails = 0; { const char *nm = wickra_rogers_satchell_volatility_name(h); if (!nm || strcmp(nm, "RogersSatchellVolatility") != 0) { printf("FAIL RogersSatchellVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rogers_satchell_volatility_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("RogersSatchellVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rogers_satchell_volatility_free(h); return fails; } static int check_RollMeasure(void) { struct RollMeasure *h = wickra_roll_measure_new((uintptr_t)20); if (!h) { printf("FAIL RollMeasure: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollMeasure", &exp); int fails = 0; { const char *nm = wickra_roll_measure_name(h); if (!nm || strcmp(nm, "RollMeasure") != 0) { printf("FAIL RollMeasure: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_roll_measure_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("RollMeasure", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_roll_measure_free(h); return fails; } static int check_RollingCorrelation(void) { struct RollingCorrelation *h = wickra_rolling_correlation_new((uintptr_t)14); if (!h) { printf("FAIL RollingCorrelation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingCorrelation", &exp); int fails = 0; { const char *nm = wickra_rolling_correlation_name(h); if (!nm || strcmp(nm, "RollingCorrelation") != 0) { printf("FAIL RollingCorrelation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_correlation_update(h, c, o); fails += cmp_row("RollingCorrelation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_correlation_free(h); return fails; } static int check_RollingCovariance(void) { struct RollingCovariance *h = wickra_rolling_covariance_new((uintptr_t)14); if (!h) { printf("FAIL RollingCovariance: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingCovariance", &exp); int fails = 0; { const char *nm = wickra_rolling_covariance_name(h); if (!nm || strcmp(nm, "RollingCovariance") != 0) { printf("FAIL RollingCovariance: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_covariance_update(h, c, o); fails += cmp_row("RollingCovariance", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_covariance_free(h); return fails; } static int check_RollingIqr(void) { struct RollingIqr *h = wickra_rolling_iqr_new((uintptr_t)14); if (!h) { printf("FAIL RollingIqr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingIqr", &exp); int fails = 0; { const char *nm = wickra_rolling_iqr_name(h); if (!nm || strcmp(nm, "RollingIqr") != 0) { printf("FAIL RollingIqr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_iqr_update(h, c); fails += cmp_row("RollingIqr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_iqr_free(h); return fails; } static int check_RollingMinMaxScaler(void) { struct RollingMinMaxScaler *h = wickra_rolling_min_max_scaler_new((uintptr_t)14); if (!h) { printf("FAIL RollingMinMaxScaler: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingMinMaxScaler", &exp); int fails = 0; { const char *nm = wickra_rolling_min_max_scaler_name(h); if (!nm || strcmp(nm, "RollingMinMaxScaler") != 0) { printf("FAIL RollingMinMaxScaler: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_min_max_scaler_update(h, c); fails += cmp_row("RollingMinMaxScaler", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_min_max_scaler_free(h); return fails; } static int check_RollingPercentileRank(void) { struct RollingPercentileRank *h = wickra_rolling_percentile_rank_new((uintptr_t)14); if (!h) { printf("FAIL RollingPercentileRank: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingPercentileRank", &exp); int fails = 0; { const char *nm = wickra_rolling_percentile_rank_name(h); if (!nm || strcmp(nm, "RollingPercentileRank") != 0) { printf("FAIL RollingPercentileRank: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_percentile_rank_update(h, c); fails += cmp_row("RollingPercentileRank", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_percentile_rank_free(h); return fails; } static int check_RollingQuantile(void) { struct RollingQuantile *h = wickra_rolling_quantile_new((uintptr_t)20, 0.5); if (!h) { printf("FAIL RollingQuantile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingQuantile", &exp); int fails = 0; { const char *nm = wickra_rolling_quantile_name(h); if (!nm || strcmp(nm, "RollingQuantile") != 0) { printf("FAIL RollingQuantile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_quantile_update(h, c); fails += cmp_row("RollingQuantile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_quantile_free(h); return fails; } static int check_RollingVwap(void) { struct RollingVwap *h = wickra_rolling_vwap_new((uintptr_t)14); if (!h) { printf("FAIL RollingVwap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RollingVwap", &exp); int fails = 0; { const char *nm = wickra_rolling_vwap_name(h); if (!nm || strcmp(nm, "RollingVWAP") != 0) { printf("FAIL RollingVwap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rolling_vwap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("RollingVwap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rolling_vwap_free(h); return fails; } static int check_RoofingFilter(void) { struct RoofingFilter *h = wickra_roofing_filter_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL RoofingFilter: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RoofingFilter", &exp); int fails = 0; { const char *nm = wickra_roofing_filter_name(h); if (!nm || strcmp(nm, "RoofingFilter") != 0) { printf("FAIL RoofingFilter: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_roofing_filter_update(h, c); fails += cmp_row("RoofingFilter", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_roofing_filter_free(h); return fails; } static int check_Rsi(void) { struct Rsi *h = wickra_rsi_new((uintptr_t)14); if (!h) { printf("FAIL Rsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rsi", &exp); int fails = 0; { const char *nm = wickra_rsi_name(h); if (!nm || strcmp(nm, "RSI") != 0) { printf("FAIL Rsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rsi_update(h, c); fails += cmp_row("Rsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rsi_free(h); return fails; } static int check_Rsx(void) { struct Rsx *h = wickra_rsx_new((uintptr_t)14); if (!h) { printf("FAIL Rsx: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rsx", &exp); int fails = 0; { const char *nm = wickra_rsx_name(h); if (!nm || strcmp(nm, "RSX") != 0) { printf("FAIL Rsx: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rsx_update(h, c); fails += cmp_row("Rsx", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rsx_free(h); return fails; } static int check_RunBars(void) { struct RunBars *h = wickra_run_bars_new((uintptr_t)3); if (!h) { printf("FAIL RunBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RunBars", &exp); int fails = 0; { const char *nm = wickra_run_bars_name(h); if (!nm || strcmp(nm, "RunBars") != 0) { printf("FAIL RunBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraRunBar bbuf[256]; uintptr_t k = wickra_run_bars_update(h, o, hi, lo, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].high; got[gn++] = (double)bbuf[b].low; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].length; got[gn++] = (double)bbuf[b].direction; } fails += cmp_row("RunBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_run_bars_free(h); return fails; } static int check_Rvi(void) { struct Rvi *h = wickra_rvi_new((uintptr_t)14); if (!h) { printf("FAIL Rvi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rvi", &exp); int fails = 0; { const char *nm = wickra_rvi_name(h); if (!nm || strcmp(nm, "RVI") != 0) { printf("FAIL Rvi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rvi_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Rvi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rvi_free(h); return fails; } static int check_RviVolatility(void) { struct RviVolatility *h = wickra_rvi_volatility_new((uintptr_t)14); if (!h) { printf("FAIL RviVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_RviVolatility", &exp); int fails = 0; { const char *nm = wickra_rvi_volatility_name(h); if (!nm || strcmp(nm, "RVIVolatility") != 0) { printf("FAIL RviVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_rvi_volatility_update(h, c); fails += cmp_row("RviVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rvi_volatility_free(h); return fails; } static int check_Rwi(void) { struct Rwi *h = wickra_rwi_new((uintptr_t)14); if (!h) { printf("FAIL Rwi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Rwi", &exp); int fails = 0; { const char *nm = wickra_rwi_name(h); if (!nm || strcmp(nm, "RWI") != 0) { printf("FAIL Rwi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraRwiOutput out; if (wickra_rwi_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.high; got[gn++] = out.low; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Rwi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_rwi_free(h); return fails; } static int check_SampleEntropy(void) { struct SampleEntropy *h = wickra_sample_entropy_new((uintptr_t)20, (uintptr_t)2, 0.2); if (!h) { printf("FAIL SampleEntropy: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SampleEntropy", &exp); int fails = 0; { const char *nm = wickra_sample_entropy_name(h); if (!nm || strcmp(nm, "SampleEntropy") != 0) { printf("FAIL SampleEntropy: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sample_entropy_update(h, c); fails += cmp_row("SampleEntropy", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sample_entropy_free(h); return fails; } static int check_SarExt(void) { struct SarExt *h = wickra_sar_ext_new(2.0, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5); if (!h) { printf("FAIL SarExt: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SarExt", &exp); int fails = 0; { const char *nm = wickra_sar_ext_name(h); if (!nm || strcmp(nm, "SAREXT") != 0) { printf("FAIL SarExt: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sar_ext_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("SarExt", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sar_ext_free(h); return fails; } static int check_SeasonalZScore(void) { struct SeasonalZScore *h = wickra_seasonal_z_score_new((int32_t)14); if (!h) { printf("FAIL SeasonalZScore: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SeasonalZScore", &exp); int fails = 0; { const char *nm = wickra_seasonal_z_score_name(h); if (!nm || strcmp(nm, "SeasonalZScore") != 0) { printf("FAIL SeasonalZScore: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_seasonal_z_score_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("SeasonalZScore", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_seasonal_z_score_free(h); return fails; } static int check_SeparatingLines(void) { struct SeparatingLines *h = wickra_separating_lines_new(); if (!h) { printf("FAIL SeparatingLines: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SeparatingLines", &exp); int fails = 0; { const char *nm = wickra_separating_lines_name(h); if (!nm || strcmp(nm, "SeparatingLines") != 0) { printf("FAIL SeparatingLines: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_separating_lines_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("SeparatingLines", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_separating_lines_free(h); return fails; } static int check_SessionHighLow(void) { struct SessionHighLow *h = wickra_session_high_low_new((int32_t)14); if (!h) { printf("FAIL SessionHighLow: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SessionHighLow", &exp); int fails = 0; { const char *nm = wickra_session_high_low_name(h); if (!nm || strcmp(nm, "SessionHighLow") != 0) { printf("FAIL SessionHighLow: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraSessionHighLowOutput out; if (wickra_session_high_low_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.high; got[gn++] = out.low; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("SessionHighLow", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_session_high_low_free(h); return fails; } static int check_SessionRange(void) { struct SessionRange *h = wickra_session_range_new((int32_t)14); if (!h) { printf("FAIL SessionRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SessionRange", &exp); int fails = 0; { const char *nm = wickra_session_range_name(h); if (!nm || strcmp(nm, "SessionRange") != 0) { printf("FAIL SessionRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraSessionRangeOutput out; if (wickra_session_range_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.asia; got[gn++] = out.eu; got[gn++] = out.us; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("SessionRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_session_range_free(h); return fails; } static int check_SessionVwap(void) { struct SessionVwap *h = wickra_session_vwap_new((int32_t)14); if (!h) { printf("FAIL SessionVwap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SessionVwap", &exp); int fails = 0; { const char *nm = wickra_session_vwap_name(h); if (!nm || strcmp(nm, "SessionVwap") != 0) { printf("FAIL SessionVwap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_session_vwap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("SessionVwap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_session_vwap_free(h); return fails; } static int check_ShannonEntropy(void) { struct ShannonEntropy *h = wickra_shannon_entropy_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL ShannonEntropy: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ShannonEntropy", &exp); int fails = 0; { const char *nm = wickra_shannon_entropy_name(h); if (!nm || strcmp(nm, "ShannonEntropy") != 0) { printf("FAIL ShannonEntropy: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_shannon_entropy_update(h, c); fails += cmp_row("ShannonEntropy", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_shannon_entropy_free(h); return fails; } static int check_Shark(void) { struct Shark *h = wickra_shark_new(); if (!h) { printf("FAIL Shark: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Shark", &exp); int fails = 0; { const char *nm = wickra_shark_name(h); if (!nm || strcmp(nm, "Shark") != 0) { printf("FAIL Shark: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_shark_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Shark", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_shark_free(h); return fails; } static int check_SharpeRatio(void) { struct SharpeRatio *h = wickra_sharpe_ratio_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL SharpeRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SharpeRatio", &exp); int fails = 0; { const char *nm = wickra_sharpe_ratio_name(h); if (!nm || strcmp(nm, "SharpeRatio") != 0) { printf("FAIL SharpeRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sharpe_ratio_update(h, c); fails += cmp_row("SharpeRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sharpe_ratio_free(h); return fails; } static int check_ShootingStar(void) { struct ShootingStar *h = wickra_shooting_star_new(); if (!h) { printf("FAIL ShootingStar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ShootingStar", &exp); int fails = 0; { const char *nm = wickra_shooting_star_name(h); if (!nm || strcmp(nm, "ShootingStar") != 0) { printf("FAIL ShootingStar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_shooting_star_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ShootingStar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_shooting_star_free(h); return fails; } static int check_ShortLine(void) { struct ShortLine *h = wickra_short_line_new(); if (!h) { printf("FAIL ShortLine: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ShortLine", &exp); int fails = 0; { const char *nm = wickra_short_line_name(h); if (!nm || strcmp(nm, "ShortLine") != 0) { printf("FAIL ShortLine: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_short_line_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ShortLine", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_short_line_free(h); return fails; } static int check_SignedVolume(void) { struct SignedVolume *h = wickra_signed_volume_new(); if (!h) { printf("FAIL SignedVolume: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SignedVolume", &exp); int fails = 0; { const char *nm = wickra_signed_volume_name(h); if (!nm || strcmp(nm, "SignedVolume") != 0) { printf("FAIL SignedVolume: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_signed_volume_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("SignedVolume", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_signed_volume_free(h); return fails; } static int check_SineWave(void) { struct SineWave *h = wickra_sine_wave_new(); if (!h) { printf("FAIL SineWave: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SineWave", &exp); int fails = 0; { const char *nm = wickra_sine_wave_name(h); if (!nm || strcmp(nm, "SineWave") != 0) { printf("FAIL SineWave: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sine_wave_update(h, c); fails += cmp_row("SineWave", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sine_wave_free(h); return fails; } static int check_SineWeightedMa(void) { struct SineWeightedMa *h = wickra_sine_weighted_ma_new((uintptr_t)14); if (!h) { printf("FAIL SineWeightedMa: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SineWeightedMa", &exp); int fails = 0; { const char *nm = wickra_sine_weighted_ma_name(h); if (!nm || strcmp(nm, "SWMA") != 0) { printf("FAIL SineWeightedMa: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sine_weighted_ma_update(h, c); fails += cmp_row("SineWeightedMa", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sine_weighted_ma_free(h); return fails; } static int check_SinglePrints(void) { struct SinglePrints *h = wickra_single_prints_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL SinglePrints: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SinglePrints", &exp); int fails = 0; { const char *nm = wickra_single_prints_name(h); if (!nm || strcmp(nm, "SinglePrints") != 0) { printf("FAIL SinglePrints: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_single_prints_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("SinglePrints", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_single_prints_free(h); return fails; } static int check_Skewness(void) { struct Skewness *h = wickra_skewness_new((uintptr_t)14); if (!h) { printf("FAIL Skewness: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Skewness", &exp); int fails = 0; { const char *nm = wickra_skewness_name(h); if (!nm || strcmp(nm, "Skewness") != 0) { printf("FAIL Skewness: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_skewness_update(h, c); fails += cmp_row("Skewness", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_skewness_free(h); return fails; } static int check_Sma(void) { struct Sma *h = wickra_sma_new((uintptr_t)14); if (!h) { printf("FAIL Sma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Sma", &exp); int fails = 0; { const char *nm = wickra_sma_name(h); if (!nm || strcmp(nm, "SMA") != 0) { printf("FAIL Sma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sma_update(h, c); fails += cmp_row("Sma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sma_free(h); return fails; } static int check_Smi(void) { struct Smi *h = wickra_smi_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL Smi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Smi", &exp); int fails = 0; { const char *nm = wickra_smi_name(h); if (!nm || strcmp(nm, "SMI") != 0) { printf("FAIL Smi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_smi_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Smi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_smi_free(h); return fails; } static int check_Smma(void) { struct Smma *h = wickra_smma_new((uintptr_t)14); if (!h) { printf("FAIL Smma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Smma", &exp); int fails = 0; { const char *nm = wickra_smma_name(h); if (!nm || strcmp(nm, "SMMA") != 0) { printf("FAIL Smma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_smma_update(h, c); fails += cmp_row("Smma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_smma_free(h); return fails; } static int check_SmoothedHeikinAshi(void) { struct SmoothedHeikinAshi *h = wickra_smoothed_heikin_ashi_new((uintptr_t)14); if (!h) { printf("FAIL SmoothedHeikinAshi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SmoothedHeikinAshi", &exp); int fails = 0; { const char *nm = wickra_smoothed_heikin_ashi_name(h); if (!nm || strcmp(nm, "SmoothedHeikinAshi") != 0) { printf("FAIL SmoothedHeikinAshi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraSmoothedHeikinAshiOutput out; if (wickra_smoothed_heikin_ashi_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.open; got[gn++] = out.high; got[gn++] = out.low; got[gn++] = out.close; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("SmoothedHeikinAshi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_smoothed_heikin_ashi_free(h); return fails; } static int check_SortinoRatio(void) { struct SortinoRatio *h = wickra_sortino_ratio_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL SortinoRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SortinoRatio", &exp); int fails = 0; { const char *nm = wickra_sortino_ratio_name(h); if (!nm || strcmp(nm, "SortinoRatio") != 0) { printf("FAIL SortinoRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sortino_ratio_update(h, c); fails += cmp_row("SortinoRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sortino_ratio_free(h); return fails; } static int check_SpearmanCorrelation(void) { struct SpearmanCorrelation *h = wickra_spearman_correlation_new((uintptr_t)14); if (!h) { printf("FAIL SpearmanCorrelation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SpearmanCorrelation", &exp); int fails = 0; { const char *nm = wickra_spearman_correlation_name(h); if (!nm || strcmp(nm, "SpearmanCorrelation") != 0) { printf("FAIL SpearmanCorrelation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_spearman_correlation_update(h, c, o); fails += cmp_row("SpearmanCorrelation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_spearman_correlation_free(h); return fails; } static int check_SpinningTop(void) { struct SpinningTop *h = wickra_spinning_top_new(); if (!h) { printf("FAIL SpinningTop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SpinningTop", &exp); int fails = 0; { const char *nm = wickra_spinning_top_name(h); if (!nm || strcmp(nm, "SpinningTop") != 0) { printf("FAIL SpinningTop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_spinning_top_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("SpinningTop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_spinning_top_free(h); return fails; } static int check_SpreadAr1Coefficient(void) { struct SpreadAr1Coefficient *h = wickra_spread_ar1_coefficient_new((uintptr_t)14); if (!h) { printf("FAIL SpreadAr1Coefficient: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SpreadAr1Coefficient", &exp); int fails = 0; { const char *nm = wickra_spread_ar1_coefficient_name(h); if (!nm || strcmp(nm, "SpreadAr1Coefficient") != 0) { printf("FAIL SpreadAr1Coefficient: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_spread_ar1_coefficient_update(h, c, o); fails += cmp_row("SpreadAr1Coefficient", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_spread_ar1_coefficient_free(h); return fails; } static int check_SpreadBollingerBands(void) { struct SpreadBollingerBands *h = wickra_spread_bollinger_bands_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL SpreadBollingerBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SpreadBollingerBands", &exp); int fails = 0; { const char *nm = wickra_spread_bollinger_bands_name(h); if (!nm || strcmp(nm, "SpreadBollingerBands") != 0) { printf("FAIL SpreadBollingerBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraSpreadBollingerBandsOutput out; if (wickra_spread_bollinger_bands_update(h, c, o, &out)) { got[gn++] = out.middle; got[gn++] = out.upper; got[gn++] = out.lower; got[gn++] = out.percent_b; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("SpreadBollingerBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_spread_bollinger_bands_free(h); return fails; } static int check_SpreadHurst(void) { struct SpreadHurst *h = wickra_spread_hurst_new((uintptr_t)14); if (!h) { printf("FAIL SpreadHurst: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SpreadHurst", &exp); int fails = 0; { const char *nm = wickra_spread_hurst_name(h); if (!nm || strcmp(nm, "SpreadHurst") != 0) { printf("FAIL SpreadHurst: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_spread_hurst_update(h, c, o); fails += cmp_row("SpreadHurst", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_spread_hurst_free(h); return fails; } static int check_StalledPattern(void) { struct StalledPattern *h = wickra_stalled_pattern_new(); if (!h) { printf("FAIL StalledPattern: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StalledPattern", &exp); int fails = 0; { const char *nm = wickra_stalled_pattern_name(h); if (!nm || strcmp(nm, "StalledPattern") != 0) { printf("FAIL StalledPattern: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_stalled_pattern_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("StalledPattern", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_stalled_pattern_free(h); return fails; } static int check_StandardError(void) { struct StandardError *h = wickra_standard_error_new((uintptr_t)14); if (!h) { printf("FAIL StandardError: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StandardError", &exp); int fails = 0; { const char *nm = wickra_standard_error_name(h); if (!nm || strcmp(nm, "StandardError") != 0) { printf("FAIL StandardError: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_standard_error_update(h, c); fails += cmp_row("StandardError", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_standard_error_free(h); return fails; } static int check_StandardErrorBands(void) { struct StandardErrorBands *h = wickra_standard_error_bands_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL StandardErrorBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StandardErrorBands", &exp); int fails = 0; { const char *nm = wickra_standard_error_bands_name(h); if (!nm || strcmp(nm, "StandardErrorBands") != 0) { printf("FAIL StandardErrorBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraStandardErrorBandsOutput out; if (wickra_standard_error_bands_update(h, c, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("StandardErrorBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_standard_error_bands_free(h); return fails; } static int check_StarcBands(void) { struct StarcBands *h = wickra_starc_bands_new((uintptr_t)3, (uintptr_t)7, 2.0); if (!h) { printf("FAIL StarcBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StarcBands", &exp); int fails = 0; { const char *nm = wickra_starc_bands_name(h); if (!nm || strcmp(nm, "StarcBands") != 0) { printf("FAIL StarcBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraStarcBandsOutput out; if (wickra_starc_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("StarcBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_starc_bands_free(h); return fails; } static int check_Stc(void) { struct Stc *h = wickra_stc_new((uintptr_t)10, (uintptr_t)23, (uintptr_t)10, 0.5); if (!h) { printf("FAIL Stc: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Stc", &exp); int fails = 0; { const char *nm = wickra_stc_name(h); if (!nm || strcmp(nm, "STC") != 0) { printf("FAIL Stc: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_stc_update(h, c); fails += cmp_row("Stc", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_stc_free(h); return fails; } static int check_StdDev(void) { struct StdDev *h = wickra_std_dev_new((uintptr_t)14); if (!h) { printf("FAIL StdDev: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StdDev", &exp); int fails = 0; { const char *nm = wickra_std_dev_name(h); if (!nm || strcmp(nm, "StdDev") != 0) { printf("FAIL StdDev: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_std_dev_update(h, c); fails += cmp_row("StdDev", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_std_dev_free(h); return fails; } static int check_StepTrailingStop(void) { struct StepTrailingStop *h = wickra_step_trailing_stop_new(2.0); if (!h) { printf("FAIL StepTrailingStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StepTrailingStop", &exp); int fails = 0; { const char *nm = wickra_step_trailing_stop_name(h); if (!nm || strcmp(nm, "StepTrailingStop") != 0) { printf("FAIL StepTrailingStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_step_trailing_stop_update(h, c); fails += cmp_row("StepTrailingStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_step_trailing_stop_free(h); return fails; } static int check_SterlingRatio(void) { struct SterlingRatio *h = wickra_sterling_ratio_new((uintptr_t)14); if (!h) { printf("FAIL SterlingRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SterlingRatio", &exp); int fails = 0; { const char *nm = wickra_sterling_ratio_name(h); if (!nm || strcmp(nm, "SterlingRatio") != 0) { printf("FAIL SterlingRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_sterling_ratio_update(h, c); fails += cmp_row("SterlingRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_sterling_ratio_free(h); return fails; } static int check_StickSandwich(void) { struct StickSandwich *h = wickra_stick_sandwich_new(); if (!h) { printf("FAIL StickSandwich: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StickSandwich", &exp); int fails = 0; { const char *nm = wickra_stick_sandwich_name(h); if (!nm || strcmp(nm, "StickSandwich") != 0) { printf("FAIL StickSandwich: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_stick_sandwich_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("StickSandwich", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_stick_sandwich_free(h); return fails; } static int check_StochRsi(void) { struct StochRsi *h = wickra_stoch_rsi_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL StochRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StochRsi", &exp); int fails = 0; { const char *nm = wickra_stoch_rsi_name(h); if (!nm || strcmp(nm, "StochRSI") != 0) { printf("FAIL StochRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_stoch_rsi_update(h, c); fails += cmp_row("StochRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_stoch_rsi_free(h); return fails; } static int check_Stochastic(void) { struct Stochastic *h = wickra_stochastic_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Stochastic: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Stochastic", &exp); int fails = 0; { const char *nm = wickra_stochastic_name(h); if (!nm || strcmp(nm, "Stochastic") != 0) { printf("FAIL Stochastic: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraStochasticOutput out; if (wickra_stochastic_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.k; got[gn++] = out.d; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Stochastic", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_stochastic_free(h); return fails; } static int check_StochasticCci(void) { struct StochasticCci *h = wickra_stochastic_cci_new((uintptr_t)14); if (!h) { printf("FAIL StochasticCci: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_StochasticCci", &exp); int fails = 0; { const char *nm = wickra_stochastic_cci_name(h); if (!nm || strcmp(nm, "StochasticCCI") != 0) { printf("FAIL StochasticCci: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_stochastic_cci_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("StochasticCci", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_stochastic_cci_free(h); return fails; } static int check_SuperSmoother(void) { struct SuperSmoother *h = wickra_super_smoother_new((uintptr_t)14); if (!h) { printf("FAIL SuperSmoother: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SuperSmoother", &exp); int fails = 0; { const char *nm = wickra_super_smoother_name(h); if (!nm || strcmp(nm, "SuperSmoother") != 0) { printf("FAIL SuperSmoother: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_super_smoother_update(h, c); fails += cmp_row("SuperSmoother", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_super_smoother_free(h); return fails; } static int check_SuperTrend(void) { struct SuperTrend *h = wickra_super_trend_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL SuperTrend: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_SuperTrend", &exp); int fails = 0; { const char *nm = wickra_super_trend_name(h); if (!nm || strcmp(nm, "SuperTrend") != 0) { printf("FAIL SuperTrend: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraSuperTrendOutput out; if (wickra_super_trend_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.value; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("SuperTrend", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_super_trend_free(h); return fails; } static int check_T3(void) { struct T3 *h = wickra_t3_new((uintptr_t)5, 0.7); if (!h) { printf("FAIL T3: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_T3", &exp); int fails = 0; { const char *nm = wickra_t3_name(h); if (!nm || strcmp(nm, "T3") != 0) { printf("FAIL T3: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_t3_update(h, c); fails += cmp_row("T3", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_t3_free(h); return fails; } static int check_TailRatio(void) { struct TailRatio *h = wickra_tail_ratio_new((uintptr_t)14); if (!h) { printf("FAIL TailRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TailRatio", &exp); int fails = 0; { const char *nm = wickra_tail_ratio_name(h); if (!nm || strcmp(nm, "TailRatio") != 0) { printf("FAIL TailRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tail_ratio_update(h, c); fails += cmp_row("TailRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tail_ratio_free(h); return fails; } static int check_TakerBuySellRatio(void) { struct TakerBuySellRatio *h = wickra_taker_buy_sell_ratio_new(); if (!h) { printf("FAIL TakerBuySellRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TakerBuySellRatio", &exp); int fails = 0; { const char *nm = wickra_taker_buy_sell_ratio_name(h); if (!nm || strcmp(nm, "TakerBuySellRatio") != 0) { printf("FAIL TakerBuySellRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_taker_buy_sell_ratio_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("TakerBuySellRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_taker_buy_sell_ratio_free(h); return fails; } static int check_Takuri(void) { struct Takuri *h = wickra_takuri_new(); if (!h) { printf("FAIL Takuri: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Takuri", &exp); int fails = 0; { const char *nm = wickra_takuri_name(h); if (!nm || strcmp(nm, "Takuri") != 0) { printf("FAIL Takuri: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_takuri_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Takuri", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_takuri_free(h); return fails; } static int check_TasukiGap(void) { struct TasukiGap *h = wickra_tasuki_gap_new(); if (!h) { printf("FAIL TasukiGap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TasukiGap", &exp); int fails = 0; { const char *nm = wickra_tasuki_gap_name(h); if (!nm || strcmp(nm, "TasukiGap") != 0) { printf("FAIL TasukiGap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tasuki_gap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TasukiGap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tasuki_gap_free(h); return fails; } static int check_TdCamouflage(void) { struct TdCamouflage *h = wickra_td_camouflage_new(); if (!h) { printf("FAIL TdCamouflage: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdCamouflage", &exp); int fails = 0; { const char *nm = wickra_td_camouflage_name(h); if (!nm || strcmp(nm, "TDCamouflage") != 0) { printf("FAIL TdCamouflage: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_camouflage_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdCamouflage", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_camouflage_free(h); return fails; } static int check_TdClop(void) { struct TdClop *h = wickra_td_clop_new(); if (!h) { printf("FAIL TdClop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdClop", &exp); int fails = 0; { const char *nm = wickra_td_clop_name(h); if (!nm || strcmp(nm, "TDClop") != 0) { printf("FAIL TdClop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_clop_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdClop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_clop_free(h); return fails; } static int check_TdClopwin(void) { struct TdClopwin *h = wickra_td_clopwin_new(); if (!h) { printf("FAIL TdClopwin: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdClopwin", &exp); int fails = 0; { const char *nm = wickra_td_clopwin_name(h); if (!nm || strcmp(nm, "TDClopwin") != 0) { printf("FAIL TdClopwin: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_clopwin_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdClopwin", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_clopwin_free(h); return fails; } static int check_TdCombo(void) { struct TdCombo *h = wickra_td_combo_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28); if (!h) { printf("FAIL TdCombo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdCombo", &exp); int fails = 0; { const char *nm = wickra_td_combo_name(h); if (!nm || strcmp(nm, "TDCombo") != 0) { printf("FAIL TdCombo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_combo_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdCombo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_combo_free(h); return fails; } static int check_TdCountdown(void) { struct TdCountdown *h = wickra_td_countdown_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28); if (!h) { printf("FAIL TdCountdown: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdCountdown", &exp); int fails = 0; { const char *nm = wickra_td_countdown_name(h); if (!nm || strcmp(nm, "TDCountdown") != 0) { printf("FAIL TdCountdown: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_countdown_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdCountdown", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_countdown_free(h); return fails; } static int check_TdDWave(void) { struct TdDWave *h = wickra_td_d_wave_new((uintptr_t)2); if (!h) { printf("FAIL TdDWave: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdDWave", &exp); int fails = 0; { const char *nm = wickra_td_d_wave_name(h); if (!nm || strcmp(nm, "TDDWave") != 0) { printf("FAIL TdDWave: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_d_wave_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdDWave", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_d_wave_free(h); return fails; } static int check_TdDeMarker(void) { struct TdDeMarker *h = wickra_td_de_marker_new((uintptr_t)14); if (!h) { printf("FAIL TdDeMarker: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdDeMarker", &exp); int fails = 0; { const char *nm = wickra_td_de_marker_name(h); if (!nm || strcmp(nm, "TDDeMarker") != 0) { printf("FAIL TdDeMarker: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_de_marker_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdDeMarker", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_de_marker_free(h); return fails; } static int check_TdDifferential(void) { struct TdDifferential *h = wickra_td_differential_new(); if (!h) { printf("FAIL TdDifferential: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdDifferential", &exp); int fails = 0; { const char *nm = wickra_td_differential_name(h); if (!nm || strcmp(nm, "TDDifferential") != 0) { printf("FAIL TdDifferential: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_differential_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdDifferential", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_differential_free(h); return fails; } static int check_TdLines(void) { struct TdLines *h = wickra_td_lines_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL TdLines: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdLines", &exp); int fails = 0; { const char *nm = wickra_td_lines_name(h); if (!nm || strcmp(nm, "TDLines") != 0) { printf("FAIL TdLines: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTdLinesOutput out; if (wickra_td_lines_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.resistance; got[gn++] = out.support; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("TdLines", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_lines_free(h); return fails; } static int check_TdMovingAverage(void) { struct TdMovingAverage *h = wickra_td_moving_average_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL TdMovingAverage: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdMovingAverage", &exp); int fails = 0; { const char *nm = wickra_td_moving_average_name(h); if (!nm || strcmp(nm, "TDMovingAverage") != 0) { printf("FAIL TdMovingAverage: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTdMovingAverageOutput out; if (wickra_td_moving_average_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.st1; got[gn++] = out.st2; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("TdMovingAverage", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_moving_average_free(h); return fails; } static int check_TdOpen(void) { struct TdOpen *h = wickra_td_open_new(); if (!h) { printf("FAIL TdOpen: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdOpen", &exp); int fails = 0; { const char *nm = wickra_td_open_name(h); if (!nm || strcmp(nm, "TDOpen") != 0) { printf("FAIL TdOpen: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_open_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdOpen", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_open_free(h); return fails; } static int check_TdPressure(void) { struct TdPressure *h = wickra_td_pressure_new((uintptr_t)14); if (!h) { printf("FAIL TdPressure: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdPressure", &exp); int fails = 0; { const char *nm = wickra_td_pressure_name(h); if (!nm || strcmp(nm, "TDPressure") != 0) { printf("FAIL TdPressure: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_pressure_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdPressure", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_pressure_free(h); return fails; } static int check_TdPropulsion(void) { struct TdPropulsion *h = wickra_td_propulsion_new(); if (!h) { printf("FAIL TdPropulsion: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdPropulsion", &exp); int fails = 0; { const char *nm = wickra_td_propulsion_name(h); if (!nm || strcmp(nm, "TDPropulsion") != 0) { printf("FAIL TdPropulsion: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_propulsion_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdPropulsion", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_propulsion_free(h); return fails; } static int check_TdRangeProjection(void) { struct TdRangeProjection *h = wickra_td_range_projection_new(); if (!h) { printf("FAIL TdRangeProjection: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdRangeProjection", &exp); int fails = 0; { const char *nm = wickra_td_range_projection_name(h); if (!nm || strcmp(nm, "TDRangeProjection") != 0) { printf("FAIL TdRangeProjection: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTdRangeProjectionOutput out; if (wickra_td_range_projection_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.high; got[gn++] = out.low; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("TdRangeProjection", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_range_projection_free(h); return fails; } static int check_TdRei(void) { struct TdRei *h = wickra_td_rei_new((uintptr_t)14); if (!h) { printf("FAIL TdRei: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdRei", &exp); int fails = 0; { const char *nm = wickra_td_rei_name(h); if (!nm || strcmp(nm, "TDREI") != 0) { printf("FAIL TdRei: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_rei_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdRei", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_rei_free(h); return fails; } static int check_TdRiskLevel(void) { struct TdRiskLevel *h = wickra_td_risk_level_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL TdRiskLevel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdRiskLevel", &exp); int fails = 0; { const char *nm = wickra_td_risk_level_name(h); if (!nm || strcmp(nm, "TDRiskLevel") != 0) { printf("FAIL TdRiskLevel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTdRiskLevelOutput out; if (wickra_td_risk_level_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.buy_risk; got[gn++] = out.sell_risk; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("TdRiskLevel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_risk_level_free(h); return fails; } static int check_TdSequential(void) { struct TdSequential *h = wickra_td_sequential_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14, (uintptr_t)28); if (!h) { printf("FAIL TdSequential: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdSequential", &exp); int fails = 0; { const char *nm = wickra_td_sequential_name(h); if (!nm || strcmp(nm, "TDSequential") != 0) { printf("FAIL TdSequential: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTdSequentialOutput out; if (wickra_td_sequential_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.setup; got[gn++] = out.countdown; got[gn++] = out.direction; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("TdSequential", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_sequential_free(h); return fails; } static int check_TdSetup(void) { struct TdSetup *h = wickra_td_setup_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL TdSetup: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdSetup", &exp); int fails = 0; { const char *nm = wickra_td_setup_name(h); if (!nm || strcmp(nm, "TDSetup") != 0) { printf("FAIL TdSetup: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_setup_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdSetup", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_setup_free(h); return fails; } static int check_TdTrap(void) { struct TdTrap *h = wickra_td_trap_new(); if (!h) { printf("FAIL TdTrap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TdTrap", &exp); int fails = 0; { const char *nm = wickra_td_trap_name(h); if (!nm || strcmp(nm, "TDTrap") != 0) { printf("FAIL TdTrap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_td_trap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TdTrap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_td_trap_free(h); return fails; } static int check_Tema(void) { struct Tema *h = wickra_tema_new((uintptr_t)14); if (!h) { printf("FAIL Tema: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tema", &exp); int fails = 0; { const char *nm = wickra_tema_name(h); if (!nm || strcmp(nm, "TEMA") != 0) { printf("FAIL Tema: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tema_update(h, c); fails += cmp_row("Tema", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tema_free(h); return fails; } static int check_TermStructureBasis(void) { struct TermStructureBasis *h = wickra_term_structure_basis_new(); if (!h) { printf("FAIL TermStructureBasis: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TermStructureBasis", &exp); int fails = 0; { const char *nm = wickra_term_structure_basis_name(h); if (!nm || strcmp(nm, "TermStructureBasis") != 0) { printf("FAIL TermStructureBasis: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double fr=(c-o)/c*0.01, mp=c, ip=c-0.5, fp=c+1.0, oi=v*10.0, ls=v*0.6, ss=v*0.4, tbv=v*0.55, tsv=v*0.45, ll=hi-c, sl=c-lo; got[gn++] = wickra_term_structure_basis_update(h, fr, mp, ip, fp, oi, ls, ss, tbv, tsv, ll, sl, (int64_t)i); fails += cmp_row("TermStructureBasis", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_term_structure_basis_free(h); return fails; } static int check_ThreeDrives(void) { struct ThreeDrives *h = wickra_three_drives_new(); if (!h) { printf("FAIL ThreeDrives: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeDrives", &exp); int fails = 0; { const char *nm = wickra_three_drives_name(h); if (!nm || strcmp(nm, "ThreeDrives") != 0) { printf("FAIL ThreeDrives: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_drives_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeDrives", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_drives_free(h); return fails; } static int check_ThreeInside(void) { struct ThreeInside *h = wickra_three_inside_new(); if (!h) { printf("FAIL ThreeInside: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeInside", &exp); int fails = 0; { const char *nm = wickra_three_inside_name(h); if (!nm || strcmp(nm, "ThreeInside") != 0) { printf("FAIL ThreeInside: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_inside_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeInside", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_inside_free(h); return fails; } static int check_ThreeLineBreak(void) { struct ThreeLineBreak *h = wickra_three_line_break_new((uintptr_t)14); if (!h) { printf("FAIL ThreeLineBreak: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeLineBreak", &exp); int fails = 0; { const char *nm = wickra_three_line_break_name(h); if (!nm || strcmp(nm, "ThreeLineBreak") != 0) { printf("FAIL ThreeLineBreak: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_line_break_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeLineBreak", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_line_break_free(h); return fails; } static int check_ThreeLineBreakBars(void) { struct ThreeLineBreakBars *h = wickra_three_line_break_bars_new((uintptr_t)3); if (!h) { printf("FAIL ThreeLineBreakBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeLineBreakBars", &exp); int fails = 0; { const char *nm = wickra_three_line_break_bars_name(h); if (!nm || strcmp(nm, "ThreeLineBreakBars") != 0) { printf("FAIL ThreeLineBreakBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraLineBreakBar bbuf[256]; uintptr_t k = wickra_three_line_break_bars_update(h, c, c, c, c, 1.0, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].direction; } fails += cmp_row("ThreeLineBreakBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_line_break_bars_free(h); return fails; } static int check_ThreeLineStrike(void) { struct ThreeLineStrike *h = wickra_three_line_strike_new(); if (!h) { printf("FAIL ThreeLineStrike: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeLineStrike", &exp); int fails = 0; { const char *nm = wickra_three_line_strike_name(h); if (!nm || strcmp(nm, "ThreeLineStrike") != 0) { printf("FAIL ThreeLineStrike: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_line_strike_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeLineStrike", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_line_strike_free(h); return fails; } static int check_ThreeOutside(void) { struct ThreeOutside *h = wickra_three_outside_new(); if (!h) { printf("FAIL ThreeOutside: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeOutside", &exp); int fails = 0; { const char *nm = wickra_three_outside_name(h); if (!nm || strcmp(nm, "ThreeOutside") != 0) { printf("FAIL ThreeOutside: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_outside_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeOutside", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_outside_free(h); return fails; } static int check_ThreeSoldiersOrCrows(void) { struct ThreeSoldiersOrCrows *h = wickra_three_soldiers_or_crows_new(); if (!h) { printf("FAIL ThreeSoldiersOrCrows: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeSoldiersOrCrows", &exp); int fails = 0; { const char *nm = wickra_three_soldiers_or_crows_name(h); if (!nm || strcmp(nm, "ThreeSoldiersOrCrows") != 0) { printf("FAIL ThreeSoldiersOrCrows: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_soldiers_or_crows_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeSoldiersOrCrows", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_soldiers_or_crows_free(h); return fails; } static int check_ThreeStarsInSouth(void) { struct ThreeStarsInSouth *h = wickra_three_stars_in_south_new(); if (!h) { printf("FAIL ThreeStarsInSouth: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ThreeStarsInSouth", &exp); int fails = 0; { const char *nm = wickra_three_stars_in_south_name(h); if (!nm || strcmp(nm, "ThreeStarsInSouth") != 0) { printf("FAIL ThreeStarsInSouth: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_three_stars_in_south_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("ThreeStarsInSouth", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_three_stars_in_south_free(h); return fails; } static int check_Thrusting(void) { struct Thrusting *h = wickra_thrusting_new(); if (!h) { printf("FAIL Thrusting: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Thrusting", &exp); int fails = 0; { const char *nm = wickra_thrusting_name(h); if (!nm || strcmp(nm, "Thrusting") != 0) { printf("FAIL Thrusting: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_thrusting_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Thrusting", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_thrusting_free(h); return fails; } static int check_TickBars(void) { struct TickBars *h = wickra_tick_bars_new((uintptr_t)2); if (!h) { printf("FAIL TickBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TickBars", &exp); int fails = 0; { const char *nm = wickra_tick_bars_name(h); if (!nm || strcmp(nm, "TickBars") != 0) { printf("FAIL TickBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTickBar bbuf[256]; uintptr_t k = wickra_tick_bars_update(h, o, hi, lo, c, v, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].high; got[gn++] = (double)bbuf[b].low; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].volume; } fails += cmp_row("TickBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tick_bars_free(h); return fails; } static int check_TickIndex(void) { struct TickIndex *h = wickra_tick_index_new(); if (!h) { printf("FAIL TickIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TickIndex", &exp); int fails = 0; { const char *nm = wickra_tick_index_name(h); if (!nm || strcmp(nm, "TickIndex") != 0) { printf("FAIL TickIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_tick_index_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("TickIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tick_index_free(h); return fails; } static int check_Tii(void) { struct Tii *h = wickra_tii_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Tii: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tii", &exp); int fails = 0; { const char *nm = wickra_tii_name(h); if (!nm || strcmp(nm, "TII") != 0) { printf("FAIL Tii: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tii_update(h, c); fails += cmp_row("Tii", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tii_free(h); return fails; } static int check_TimeBasedStop(void) { struct TimeBasedStop *h = wickra_time_based_stop_new((uintptr_t)14); if (!h) { printf("FAIL TimeBasedStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TimeBasedStop", &exp); int fails = 0; { const char *nm = wickra_time_based_stop_name(h); if (!nm || strcmp(nm, "TimeBasedStop") != 0) { printf("FAIL TimeBasedStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_time_based_stop_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TimeBasedStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_time_based_stop_free(h); return fails; } static int check_TimeOfDayReturnProfile(void) { struct TimeOfDayReturnProfile *h = wickra_time_of_day_return_profile_new((uintptr_t)24, (int32_t)0); if (!h) { printf("FAIL TimeOfDayReturnProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TimeOfDayReturnProfile", &exp); int fails = 0; { const char *nm = wickra_time_of_day_return_profile_name(h); if (!nm || strcmp(nm, "TimeOfDayReturnProfile") != 0) { printf("FAIL TimeOfDayReturnProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double vbuf[256]; intptr_t k = wickra_time_of_day_return_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256); if (k < 0) { for (int z = 0; z < 24; z++) got[gn++] = NANV; } else { for (int z = 0; z < 24; z++) got[gn++] = vbuf[z]; } fails += cmp_row("TimeOfDayReturnProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_time_of_day_return_profile_free(h); return fails; } static int check_TowerTopBottom(void) { struct TowerTopBottom *h = wickra_tower_top_bottom_new(); if (!h) { printf("FAIL TowerTopBottom: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TowerTopBottom", &exp); int fails = 0; { const char *nm = wickra_tower_top_bottom_name(h); if (!nm || strcmp(nm, "TowerTopBottom") != 0) { printf("FAIL TowerTopBottom: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tower_top_bottom_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TowerTopBottom", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tower_top_bottom_free(h); return fails; } static int check_TpoProfile(void) { struct TpoProfile *h = wickra_tpo_profile_new((uintptr_t)30, (uintptr_t)50); if (!h) { printf("FAIL TpoProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TpoProfile", &exp); int fails = 0; { const char *nm = wickra_tpo_profile_name(h); if (!nm || strcmp(nm, "TpoProfile") != 0) { printf("FAIL TpoProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double vbuf[256]; struct WickraTpoProfileOutputScalars sc; intptr_t k = wickra_tpo_profile_update(h, o, hi, lo, c, v, (int64_t)i, &sc, vbuf, 256); if (k < 0) { for (int z = 0; z < 52; z++) got[gn++] = NANV; } else { got[gn++] = sc.price_low; got[gn++] = sc.price_high; for (int z = 0; z < 50; z++) got[gn++] = vbuf[z]; } fails += cmp_row("TpoProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tpo_profile_free(h); return fails; } static int check_TradeImbalance(void) { struct TradeImbalance *h = wickra_trade_imbalance_new((uintptr_t)20); if (!h) { printf("FAIL TradeImbalance: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TradeImbalance", &exp); int fails = 0; { const char *nm = wickra_trade_imbalance_name(h); if (!nm || strcmp(nm, "TradeImbalance") != 0) { printf("FAIL TradeImbalance: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trade_imbalance_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("TradeImbalance", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trade_imbalance_free(h); return fails; } static int check_TradeSignAutocorrelation(void) { struct TradeSignAutocorrelation *h = wickra_trade_sign_autocorrelation_new((uintptr_t)20); if (!h) { printf("FAIL TradeSignAutocorrelation: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TradeSignAutocorrelation", &exp); int fails = 0; { const char *nm = wickra_trade_sign_autocorrelation_name(h); if (!nm || strcmp(nm, "TradeSignAutocorrelation") != 0) { printf("FAIL TradeSignAutocorrelation: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trade_sign_autocorrelation_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("TradeSignAutocorrelation", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trade_sign_autocorrelation_free(h); return fails; } static int check_TradeVolumeIndex(void) { struct TradeVolumeIndex *h = wickra_trade_volume_index_new(2.0); if (!h) { printf("FAIL TradeVolumeIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TradeVolumeIndex", &exp); int fails = 0; { const char *nm = wickra_trade_volume_index_name(h); if (!nm || strcmp(nm, "TradeVolumeIndex") != 0) { printf("FAIL TradeVolumeIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trade_volume_index_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TradeVolumeIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trade_volume_index_free(h); return fails; } static int check_TrendLabel(void) { struct TrendLabel *h = wickra_trend_label_new((uintptr_t)14); if (!h) { printf("FAIL TrendLabel: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TrendLabel", &exp); int fails = 0; { const char *nm = wickra_trend_label_name(h); if (!nm || strcmp(nm, "TrendLabel") != 0) { printf("FAIL TrendLabel: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trend_label_update(h, c); fails += cmp_row("TrendLabel", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trend_label_free(h); return fails; } static int check_TrendStrengthIndex(void) { struct TrendStrengthIndex *h = wickra_trend_strength_index_new((uintptr_t)14); if (!h) { printf("FAIL TrendStrengthIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TrendStrengthIndex", &exp); int fails = 0; { const char *nm = wickra_trend_strength_index_name(h); if (!nm || strcmp(nm, "TrendStrengthIndex") != 0) { printf("FAIL TrendStrengthIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trend_strength_index_update(h, c); fails += cmp_row("TrendStrengthIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trend_strength_index_free(h); return fails; } static int check_Trendflex(void) { struct Trendflex *h = wickra_trendflex_new((uintptr_t)14); if (!h) { printf("FAIL Trendflex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Trendflex", &exp); int fails = 0; { const char *nm = wickra_trendflex_name(h); if (!nm || strcmp(nm, "Trendflex") != 0) { printf("FAIL Trendflex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trendflex_update(h, c); fails += cmp_row("Trendflex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trendflex_free(h); return fails; } static int check_TreynorRatio(void) { struct TreynorRatio *h = wickra_treynor_ratio_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL TreynorRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TreynorRatio", &exp); int fails = 0; { const char *nm = wickra_treynor_ratio_name(h); if (!nm || strcmp(nm, "TreynorRatio") != 0) { printf("FAIL TreynorRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_treynor_ratio_update(h, c, o); fails += cmp_row("TreynorRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_treynor_ratio_free(h); return fails; } static int check_Triangle(void) { struct Triangle *h = wickra_triangle_new(); if (!h) { printf("FAIL Triangle: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Triangle", &exp); int fails = 0; { const char *nm = wickra_triangle_name(h); if (!nm || strcmp(nm, "Triangle") != 0) { printf("FAIL Triangle: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_triangle_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Triangle", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_triangle_free(h); return fails; } static int check_Trima(void) { struct Trima *h = wickra_trima_new((uintptr_t)14); if (!h) { printf("FAIL Trima: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Trima", &exp); int fails = 0; { const char *nm = wickra_trima_name(h); if (!nm || strcmp(nm, "TRIMA") != 0) { printf("FAIL Trima: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trima_update(h, c); fails += cmp_row("Trima", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trima_free(h); return fails; } static int check_Trin(void) { struct Trin *h = wickra_trin_new(); if (!h) { printf("FAIL Trin: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Trin", &exp); int fails = 0; { const char *nm = wickra_trin_name(h); if (!nm || strcmp(nm, "Trin") != 0) { printf("FAIL Trin: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_trin_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("Trin", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trin_free(h); return fails; } static int check_TripleTopBottom(void) { struct TripleTopBottom *h = wickra_triple_top_bottom_new(); if (!h) { printf("FAIL TripleTopBottom: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TripleTopBottom", &exp); int fails = 0; { const char *nm = wickra_triple_top_bottom_name(h); if (!nm || strcmp(nm, "TripleTopBottom") != 0) { printf("FAIL TripleTopBottom: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_triple_top_bottom_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TripleTopBottom", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_triple_top_bottom_free(h); return fails; } static int check_Tristar(void) { struct Tristar *h = wickra_tristar_new(); if (!h) { printf("FAIL Tristar: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tristar", &exp); int fails = 0; { const char *nm = wickra_tristar_name(h); if (!nm || strcmp(nm, "Tristar") != 0) { printf("FAIL Tristar: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tristar_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Tristar", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tristar_free(h); return fails; } static int check_Trix(void) { struct Trix *h = wickra_trix_new((uintptr_t)14); if (!h) { printf("FAIL Trix: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Trix", &exp); int fails = 0; { const char *nm = wickra_trix_name(h); if (!nm || strcmp(nm, "TRIX") != 0) { printf("FAIL Trix: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_trix_update(h, c); fails += cmp_row("Trix", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_trix_free(h); return fails; } static int check_TrueRange(void) { struct TrueRange *h = wickra_true_range_new(); if (!h) { printf("FAIL TrueRange: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TrueRange", &exp); int fails = 0; { const char *nm = wickra_true_range_name(h); if (!nm || strcmp(nm, "TrueRange") != 0) { printf("FAIL TrueRange: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_true_range_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TrueRange", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_true_range_free(h); return fails; } static int check_Tsf(void) { struct Tsf *h = wickra_tsf_new((uintptr_t)14); if (!h) { printf("FAIL Tsf: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tsf", &exp); int fails = 0; { const char *nm = wickra_tsf_name(h); if (!nm || strcmp(nm, "TSF") != 0) { printf("FAIL Tsf: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tsf_update(h, c); fails += cmp_row("Tsf", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tsf_free(h); return fails; } static int check_TsfOscillator(void) { struct TsfOscillator *h = wickra_tsf_oscillator_new((uintptr_t)14); if (!h) { printf("FAIL TsfOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TsfOscillator", &exp); int fails = 0; { const char *nm = wickra_tsf_oscillator_name(h); if (!nm || strcmp(nm, "TsfOscillator") != 0) { printf("FAIL TsfOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tsf_oscillator_update(h, c); fails += cmp_row("TsfOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tsf_oscillator_free(h); return fails; } static int check_Tsi(void) { struct Tsi *h = wickra_tsi_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Tsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tsi", &exp); int fails = 0; { const char *nm = wickra_tsi_name(h); if (!nm || strcmp(nm, "TSI") != 0) { printf("FAIL Tsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tsi_update(h, c); fails += cmp_row("Tsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tsi_free(h); return fails; } static int check_Tsv(void) { struct Tsv *h = wickra_tsv_new((uintptr_t)14); if (!h) { printf("FAIL Tsv: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tsv", &exp); int fails = 0; { const char *nm = wickra_tsv_name(h); if (!nm || strcmp(nm, "TSV") != 0) { printf("FAIL Tsv: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tsv_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Tsv", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tsv_free(h); return fails; } static int check_TtmSqueeze(void) { struct TtmSqueeze *h = wickra_ttm_squeeze_new((uintptr_t)14, 2.0, 0.5); if (!h) { printf("FAIL TtmSqueeze: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TtmSqueeze", &exp); int fails = 0; { const char *nm = wickra_ttm_squeeze_name(h); if (!nm || strcmp(nm, "TtmSqueeze") != 0) { printf("FAIL TtmSqueeze: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraTtmSqueezeOutput out; if (wickra_ttm_squeeze_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.squeeze; got[gn++] = out.momentum; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("TtmSqueeze", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ttm_squeeze_free(h); return fails; } static int check_TtmTrend(void) { struct TtmTrend *h = wickra_ttm_trend_new((uintptr_t)14); if (!h) { printf("FAIL TtmTrend: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TtmTrend", &exp); int fails = 0; { const char *nm = wickra_ttm_trend_name(h); if (!nm || strcmp(nm, "TtmTrend") != 0) { printf("FAIL TtmTrend: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ttm_trend_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TtmTrend", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ttm_trend_free(h); return fails; } static int check_TurnOfMonth(void) { struct TurnOfMonth *h = wickra_turn_of_month_new(3.0, 3.0, (int32_t)0); if (!h) { printf("FAIL TurnOfMonth: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TurnOfMonth", &exp); int fails = 0; { const char *nm = wickra_turn_of_month_name(h); if (!nm || strcmp(nm, "TurnOfMonth") != 0) { printf("FAIL TurnOfMonth: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_turn_of_month_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TurnOfMonth", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_turn_of_month_free(h); return fails; } static int check_Tweezer(void) { struct Tweezer *h = wickra_tweezer_new(); if (!h) { printf("FAIL Tweezer: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Tweezer", &exp); int fails = 0; { const char *nm = wickra_tweezer_name(h); if (!nm || strcmp(nm, "Tweezer") != 0) { printf("FAIL Tweezer: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_tweezer_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Tweezer", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_tweezer_free(h); return fails; } static int check_TwiggsMoneyFlow(void) { struct TwiggsMoneyFlow *h = wickra_twiggs_money_flow_new((uintptr_t)14); if (!h) { printf("FAIL TwiggsMoneyFlow: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TwiggsMoneyFlow", &exp); int fails = 0; { const char *nm = wickra_twiggs_money_flow_name(h); if (!nm || strcmp(nm, "TwiggsMoneyFlow") != 0) { printf("FAIL TwiggsMoneyFlow: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_twiggs_money_flow_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TwiggsMoneyFlow", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_twiggs_money_flow_free(h); return fails; } static int check_TwoCrows(void) { struct TwoCrows *h = wickra_two_crows_new(); if (!h) { printf("FAIL TwoCrows: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TwoCrows", &exp); int fails = 0; { const char *nm = wickra_two_crows_name(h); if (!nm || strcmp(nm, "TwoCrows") != 0) { printf("FAIL TwoCrows: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_two_crows_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TwoCrows", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_two_crows_free(h); return fails; } static int check_TypicalPrice(void) { struct TypicalPrice *h = wickra_typical_price_new(); if (!h) { printf("FAIL TypicalPrice: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_TypicalPrice", &exp); int fails = 0; { const char *nm = wickra_typical_price_name(h); if (!nm || strcmp(nm, "TypicalPrice") != 0) { printf("FAIL TypicalPrice: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_typical_price_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("TypicalPrice", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_typical_price_free(h); return fails; } static int check_UlcerIndex(void) { struct UlcerIndex *h = wickra_ulcer_index_new((uintptr_t)14); if (!h) { printf("FAIL UlcerIndex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UlcerIndex", &exp); int fails = 0; { const char *nm = wickra_ulcer_index_name(h); if (!nm || strcmp(nm, "UlcerIndex") != 0) { printf("FAIL UlcerIndex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ulcer_index_update(h, c); fails += cmp_row("UlcerIndex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ulcer_index_free(h); return fails; } static int check_UltimateOscillator(void) { struct UltimateOscillator *h = wickra_ultimate_oscillator_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL UltimateOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UltimateOscillator", &exp); int fails = 0; { const char *nm = wickra_ultimate_oscillator_name(h); if (!nm || strcmp(nm, "UltimateOscillator") != 0) { printf("FAIL UltimateOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_ultimate_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("UltimateOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_ultimate_oscillator_free(h); return fails; } static int check_UniqueThreeRiver(void) { struct UniqueThreeRiver *h = wickra_unique_three_river_new(); if (!h) { printf("FAIL UniqueThreeRiver: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UniqueThreeRiver", &exp); int fails = 0; { const char *nm = wickra_unique_three_river_name(h); if (!nm || strcmp(nm, "UniqueThreeRiver") != 0) { printf("FAIL UniqueThreeRiver: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_unique_three_river_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("UniqueThreeRiver", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_unique_three_river_free(h); return fails; } static int check_UniversalOscillator(void) { struct UniversalOscillator *h = wickra_universal_oscillator_new((uintptr_t)14); if (!h) { printf("FAIL UniversalOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UniversalOscillator", &exp); int fails = 0; { const char *nm = wickra_universal_oscillator_name(h); if (!nm || strcmp(nm, "UniversalOscillator") != 0) { printf("FAIL UniversalOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_universal_oscillator_update(h, c); fails += cmp_row("UniversalOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_universal_oscillator_free(h); return fails; } static int check_UpDownVolumeRatio(void) { struct UpDownVolumeRatio *h = wickra_up_down_volume_ratio_new(); if (!h) { printf("FAIL UpDownVolumeRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UpDownVolumeRatio", &exp); int fails = 0; { const char *nm = wickra_up_down_volume_ratio_name(h); if (!nm || strcmp(nm, "UpDownVolumeRatio") != 0) { printf("FAIL UpDownVolumeRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double chg[5], vol[5]; bool nh[5], nl[5], am[5], ob[5]; for (int j = 0; j < 5; j++) { chg[j] = (c-o)+j; vol[j] = v + j*10.0; nh[j] = (j%2==0); nl[j] = (j%3==0); am[j] = (j%2==0); ob[j] = (j%3==0); } got[gn++] = wickra_up_down_volume_ratio_update(h, chg, vol, nh, nl, am, ob, 5, (int64_t)i); fails += cmp_row("UpDownVolumeRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_up_down_volume_ratio_free(h); return fails; } static int check_UpsideGapThreeMethods(void) { struct UpsideGapThreeMethods *h = wickra_upside_gap_three_methods_new(); if (!h) { printf("FAIL UpsideGapThreeMethods: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UpsideGapThreeMethods", &exp); int fails = 0; { const char *nm = wickra_upside_gap_three_methods_name(h); if (!nm || strcmp(nm, "UpsideGapThreeMethods") != 0) { printf("FAIL UpsideGapThreeMethods: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_upside_gap_three_methods_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("UpsideGapThreeMethods", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_upside_gap_three_methods_free(h); return fails; } static int check_UpsideGapTwoCrows(void) { struct UpsideGapTwoCrows *h = wickra_upside_gap_two_crows_new(); if (!h) { printf("FAIL UpsideGapTwoCrows: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UpsideGapTwoCrows", &exp); int fails = 0; { const char *nm = wickra_upside_gap_two_crows_name(h); if (!nm || strcmp(nm, "UpsideGapTwoCrows") != 0) { printf("FAIL UpsideGapTwoCrows: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_upside_gap_two_crows_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("UpsideGapTwoCrows", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_upside_gap_two_crows_free(h); return fails; } static int check_UpsidePotentialRatio(void) { struct UpsidePotentialRatio *h = wickra_upside_potential_ratio_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL UpsidePotentialRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_UpsidePotentialRatio", &exp); int fails = 0; { const char *nm = wickra_upside_potential_ratio_name(h); if (!nm || strcmp(nm, "UpsidePotentialRatio") != 0) { printf("FAIL UpsidePotentialRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_upside_potential_ratio_update(h, c); fails += cmp_row("UpsidePotentialRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_upside_potential_ratio_free(h); return fails; } static int check_ValueArea(void) { struct ValueArea *h = wickra_value_area_new((uintptr_t)20, (uintptr_t)50, 0.7); if (!h) { printf("FAIL ValueArea: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ValueArea", &exp); int fails = 0; { const char *nm = wickra_value_area_name(h); if (!nm || strcmp(nm, "ValueArea") != 0) { printf("FAIL ValueArea: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraValueAreaOutput out; if (wickra_value_area_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.poc; got[gn++] = out.vah; got[gn++] = out.val; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("ValueArea", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_value_area_free(h); return fails; } static int check_ValueAtRisk(void) { struct ValueAtRisk *h = wickra_value_at_risk_new((uintptr_t)20, 0.95); if (!h) { printf("FAIL ValueAtRisk: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ValueAtRisk", &exp); int fails = 0; { const char *nm = wickra_value_at_risk_name(h); if (!nm || strcmp(nm, "ValueAtRisk") != 0) { printf("FAIL ValueAtRisk: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_value_at_risk_update(h, c); fails += cmp_row("ValueAtRisk", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_value_at_risk_free(h); return fails; } static int check_Variance(void) { struct Variance *h = wickra_variance_new((uintptr_t)14); if (!h) { printf("FAIL Variance: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Variance", &exp); int fails = 0; { const char *nm = wickra_variance_name(h); if (!nm || strcmp(nm, "Variance") != 0) { printf("FAIL Variance: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_variance_update(h, c); fails += cmp_row("Variance", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_variance_free(h); return fails; } static int check_VarianceRatio(void) { struct VarianceRatio *h = wickra_variance_ratio_new((uintptr_t)60, (uintptr_t)2); if (!h) { printf("FAIL VarianceRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VarianceRatio", &exp); int fails = 0; { const char *nm = wickra_variance_ratio_name(h); if (!nm || strcmp(nm, "VarianceRatio") != 0) { printf("FAIL VarianceRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_variance_ratio_update(h, c, o); fails += cmp_row("VarianceRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_variance_ratio_free(h); return fails; } static int check_VerticalHorizontalFilter(void) { struct VerticalHorizontalFilter *h = wickra_vertical_horizontal_filter_new((uintptr_t)14); if (!h) { printf("FAIL VerticalHorizontalFilter: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VerticalHorizontalFilter", &exp); int fails = 0; { const char *nm = wickra_vertical_horizontal_filter_name(h); if (!nm || strcmp(nm, "VerticalHorizontalFilter") != 0) { printf("FAIL VerticalHorizontalFilter: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_vertical_horizontal_filter_update(h, c); fails += cmp_row("VerticalHorizontalFilter", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vertical_horizontal_filter_free(h); return fails; } static int check_Vidya(void) { struct Vidya *h = wickra_vidya_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL Vidya: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Vidya", &exp); int fails = 0; { const char *nm = wickra_vidya_name(h); if (!nm || strcmp(nm, "VIDYA") != 0) { printf("FAIL Vidya: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_vidya_update(h, c); fails += cmp_row("Vidya", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vidya_free(h); return fails; } static int check_VolatilityCone(void) { struct VolatilityCone *h = wickra_volatility_cone_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL VolatilityCone: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolatilityCone", &exp); int fails = 0; { const char *nm = wickra_volatility_cone_name(h); if (!nm || strcmp(nm, "VolatilityCone") != 0) { printf("FAIL VolatilityCone: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraVolatilityConeOutput out; if (wickra_volatility_cone_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.current; got[gn++] = out.min; got[gn++] = out.median; got[gn++] = out.max; got[gn++] = out.percentile; } else { for (int z = 0; z < 5; z++) got[gn++] = NANV; } fails += cmp_row("VolatilityCone", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volatility_cone_free(h); return fails; } static int check_VolatilityOfVolatility(void) { struct VolatilityOfVolatility *h = wickra_volatility_of_volatility_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL VolatilityOfVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolatilityOfVolatility", &exp); int fails = 0; { const char *nm = wickra_volatility_of_volatility_name(h); if (!nm || strcmp(nm, "VolatilityOfVolatility") != 0) { printf("FAIL VolatilityOfVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_volatility_of_volatility_update(h, c); fails += cmp_row("VolatilityOfVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volatility_of_volatility_free(h); return fails; } static int check_VolatilityRatio(void) { struct VolatilityRatio *h = wickra_volatility_ratio_new((uintptr_t)14); if (!h) { printf("FAIL VolatilityRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolatilityRatio", &exp); int fails = 0; { const char *nm = wickra_volatility_ratio_name(h); if (!nm || strcmp(nm, "VolatilityRatio") != 0) { printf("FAIL VolatilityRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_volatility_ratio_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("VolatilityRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volatility_ratio_free(h); return fails; } static int check_VoltyStop(void) { struct VoltyStop *h = wickra_volty_stop_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL VoltyStop: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VoltyStop", &exp); int fails = 0; { const char *nm = wickra_volty_stop_name(h); if (!nm || strcmp(nm, "VoltyStop") != 0) { printf("FAIL VoltyStop: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_volty_stop_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("VoltyStop", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volty_stop_free(h); return fails; } static int check_VolumeBars(void) { struct VolumeBars *h = wickra_volume_bars_new(500.0); if (!h) { printf("FAIL VolumeBars: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeBars", &exp); int fails = 0; { const char *nm = wickra_volume_bars_name(h); if (!nm || strcmp(nm, "VolumeBars") != 0) { printf("FAIL VolumeBars: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraVolumeBar bbuf[256]; uintptr_t k = wickra_volume_bars_update(h, o, hi, lo, c, v, 0, bbuf, 256); for (uintptr_t b = 0; b < (uintptr_t)k; b++) { got[gn++] = (double)bbuf[b].open; got[gn++] = (double)bbuf[b].high; got[gn++] = (double)bbuf[b].low; got[gn++] = (double)bbuf[b].close; got[gn++] = (double)bbuf[b].volume; } fails += cmp_row("VolumeBars", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_bars_free(h); return fails; } static int check_VolumeByTimeProfile(void) { struct VolumeByTimeProfile *h = wickra_volume_by_time_profile_new((uintptr_t)24, (int32_t)0); if (!h) { printf("FAIL VolumeByTimeProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeByTimeProfile", &exp); int fails = 0; { const char *nm = wickra_volume_by_time_profile_name(h); if (!nm || strcmp(nm, "VolumeByTimeProfile") != 0) { printf("FAIL VolumeByTimeProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double vbuf[256]; intptr_t k = wickra_volume_by_time_profile_update(h, o, hi, lo, c, v, (int64_t)i, vbuf, 256); if (k < 0) { for (int z = 0; z < 24; z++) got[gn++] = NANV; } else { for (int z = 0; z < 24; z++) got[gn++] = vbuf[z]; } fails += cmp_row("VolumeByTimeProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_by_time_profile_free(h); return fails; } static int check_VolumeOscillator(void) { struct VolumeOscillator *h = wickra_volume_oscillator_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL VolumeOscillator: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeOscillator", &exp); int fails = 0; { const char *nm = wickra_volume_oscillator_name(h); if (!nm || strcmp(nm, "VolumeOscillator") != 0) { printf("FAIL VolumeOscillator: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_volume_oscillator_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("VolumeOscillator", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_oscillator_free(h); return fails; } static int check_VolumePriceTrend(void) { struct VolumePriceTrend *h = wickra_volume_price_trend_new(); if (!h) { printf("FAIL VolumePriceTrend: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumePriceTrend", &exp); int fails = 0; { const char *nm = wickra_volume_price_trend_name(h); if (!nm || strcmp(nm, "VPT") != 0) { printf("FAIL VolumePriceTrend: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_volume_price_trend_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("VolumePriceTrend", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_price_trend_free(h); return fails; } static int check_VolumeProfile(void) { struct VolumeProfile *h = wickra_volume_profile_new((uintptr_t)20, (uintptr_t)50); if (!h) { printf("FAIL VolumeProfile: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeProfile", &exp); int fails = 0; { const char *nm = wickra_volume_profile_name(h); if (!nm || strcmp(nm, "VolumeProfile") != 0) { printf("FAIL VolumeProfile: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; double vbuf[256]; struct WickraVolumeProfileOutputScalars sc; intptr_t k = wickra_volume_profile_update(h, o, hi, lo, c, v, (int64_t)i, &sc, vbuf, 256); if (k < 0) { for (int z = 0; z < 52; z++) got[gn++] = NANV; } else { got[gn++] = sc.price_low; got[gn++] = sc.price_high; for (int z = 0; z < 50; z++) got[gn++] = vbuf[z]; } fails += cmp_row("VolumeProfile", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_profile_free(h); return fails; } static int check_VolumeRsi(void) { struct VolumeRsi *h = wickra_volume_rsi_new((uintptr_t)14); if (!h) { printf("FAIL VolumeRsi: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeRsi", &exp); int fails = 0; { const char *nm = wickra_volume_rsi_name(h); if (!nm || strcmp(nm, "VolumeRsi") != 0) { printf("FAIL VolumeRsi: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_volume_rsi_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("VolumeRsi", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_rsi_free(h); return fails; } static int check_VolumeWeightedMacd(void) { struct VolumeWeightedMacd *h = wickra_volume_weighted_macd_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL VolumeWeightedMacd: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeWeightedMacd", &exp); int fails = 0; { const char *nm = wickra_volume_weighted_macd_name(h); if (!nm || strcmp(nm, "VolumeWeightedMacd") != 0) { printf("FAIL VolumeWeightedMacd: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraVolumeWeightedMacdOutput out; if (wickra_volume_weighted_macd_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.macd; got[gn++] = out.signal; got[gn++] = out.histogram; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("VolumeWeightedMacd", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_weighted_macd_free(h); return fails; } static int check_VolumeWeightedSr(void) { struct VolumeWeightedSr *h = wickra_volume_weighted_sr_new((uintptr_t)14); if (!h) { printf("FAIL VolumeWeightedSr: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VolumeWeightedSr", &exp); int fails = 0; { const char *nm = wickra_volume_weighted_sr_name(h); if (!nm || strcmp(nm, "VolumeWeightedSr") != 0) { printf("FAIL VolumeWeightedSr: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraVolumeWeightedSrOutput out; if (wickra_volume_weighted_sr_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.support; got[gn++] = out.resistance; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("VolumeWeightedSr", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_volume_weighted_sr_free(h); return fails; } static int check_Vortex(void) { struct Vortex *h = wickra_vortex_new((uintptr_t)14); if (!h) { printf("FAIL Vortex: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Vortex", &exp); int fails = 0; { const char *nm = wickra_vortex_name(h); if (!nm || strcmp(nm, "Vortex") != 0) { printf("FAIL Vortex: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraVortexOutput out; if (wickra_vortex_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.plus; got[gn++] = out.minus; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("Vortex", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vortex_free(h); return fails; } static int check_Vpin(void) { struct Vpin *h = wickra_vpin_new(5000.0, (uintptr_t)10); if (!h) { printf("FAIL Vpin: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Vpin", &exp); int fails = 0; { const char *nm = wickra_vpin_name(h); if (!nm || strcmp(nm, "Vpin") != 0) { printf("FAIL Vpin: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_vpin_update(h, c, v, c >= o, (int64_t)i); fails += cmp_row("Vpin", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vpin_free(h); return fails; } static int check_Vwap(void) { struct Vwap *h = wickra_vwap_new(); if (!h) { printf("FAIL Vwap: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Vwap", &exp); int fails = 0; { const char *nm = wickra_vwap_name(h); if (!nm || strcmp(nm, "VWAP") != 0) { printf("FAIL Vwap: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_vwap_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Vwap", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vwap_free(h); return fails; } static int check_VwapStdDevBands(void) { struct VwapStdDevBands *h = wickra_vwap_std_dev_bands_new(2.0); if (!h) { printf("FAIL VwapStdDevBands: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_VwapStdDevBands", &exp); int fails = 0; { const char *nm = wickra_vwap_std_dev_bands_name(h); if (!nm || strcmp(nm, "VwapStdDevBands") != 0) { printf("FAIL VwapStdDevBands: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraVwapStdDevBandsOutput out; if (wickra_vwap_std_dev_bands_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.upper; got[gn++] = out.middle; got[gn++] = out.lower; got[gn++] = out.stddev; } else { for (int z = 0; z < 4; z++) got[gn++] = NANV; } fails += cmp_row("VwapStdDevBands", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vwap_std_dev_bands_free(h); return fails; } static int check_Vwma(void) { struct Vwma *h = wickra_vwma_new((uintptr_t)14); if (!h) { printf("FAIL Vwma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Vwma", &exp); int fails = 0; { const char *nm = wickra_vwma_name(h); if (!nm || strcmp(nm, "VWMA") != 0) { printf("FAIL Vwma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_vwma_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Vwma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vwma_free(h); return fails; } static int check_Vzo(void) { struct Vzo *h = wickra_vzo_new((uintptr_t)14); if (!h) { printf("FAIL Vzo: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Vzo", &exp); int fails = 0; { const char *nm = wickra_vzo_name(h); if (!nm || strcmp(nm, "VZO") != 0) { printf("FAIL Vzo: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_vzo_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Vzo", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_vzo_free(h); return fails; } static int check_Wad(void) { struct Wad *h = wickra_wad_new(); if (!h) { printf("FAIL Wad: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Wad", &exp); int fails = 0; { const char *nm = wickra_wad_name(h); if (!nm || strcmp(nm, "Wad") != 0) { printf("FAIL Wad: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_wad_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Wad", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_wad_free(h); return fails; } static int check_WavePm(void) { struct WavePm *h = wickra_wave_pm_new((uintptr_t)3, (uintptr_t)7); if (!h) { printf("FAIL WavePm: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WavePm", &exp); int fails = 0; { const char *nm = wickra_wave_pm_name(h); if (!nm || strcmp(nm, "WavePm") != 0) { printf("FAIL WavePm: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_wave_pm_update(h, c); fails += cmp_row("WavePm", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_wave_pm_free(h); return fails; } static int check_WaveTrend(void) { struct WaveTrend *h = wickra_wave_trend_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL WaveTrend: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WaveTrend", &exp); int fails = 0; { const char *nm = wickra_wave_trend_name(h); if (!nm || strcmp(nm, "WaveTrend") != 0) { printf("FAIL WaveTrend: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraWaveTrendOutput out; if (wickra_wave_trend_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.wt1; got[gn++] = out.wt2; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("WaveTrend", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_wave_trend_free(h); return fails; } static int check_Wedge(void) { struct Wedge *h = wickra_wedge_new(); if (!h) { printf("FAIL Wedge: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Wedge", &exp); int fails = 0; { const char *nm = wickra_wedge_name(h); if (!nm || strcmp(nm, "Wedge") != 0) { printf("FAIL Wedge: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_wedge_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("Wedge", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_wedge_free(h); return fails; } static int check_WeightedClose(void) { struct WeightedClose *h = wickra_weighted_close_new(); if (!h) { printf("FAIL WeightedClose: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WeightedClose", &exp); int fails = 0; { const char *nm = wickra_weighted_close_name(h); if (!nm || strcmp(nm, "WeightedClose") != 0) { printf("FAIL WeightedClose: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_weighted_close_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("WeightedClose", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_weighted_close_free(h); return fails; } static int check_WickRatio(void) { struct WickRatio *h = wickra_wick_ratio_new(); if (!h) { printf("FAIL WickRatio: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WickRatio", &exp); int fails = 0; { const char *nm = wickra_wick_ratio_name(h); if (!nm || strcmp(nm, "WickRatio") != 0) { printf("FAIL WickRatio: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_wick_ratio_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("WickRatio", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_wick_ratio_free(h); return fails; } static int check_WilliamsFractals(void) { struct WilliamsFractals *h = wickra_williams_fractals_new(); if (!h) { printf("FAIL WilliamsFractals: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WilliamsFractals", &exp); int fails = 0; { const char *nm = wickra_williams_fractals_name(h); if (!nm || strcmp(nm, "WilliamsFractals") != 0) { printf("FAIL WilliamsFractals: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraWilliamsFractalsOutput out; if (wickra_williams_fractals_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.up; got[gn++] = out.down; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("WilliamsFractals", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_williams_fractals_free(h); return fails; } static int check_WilliamsR(void) { struct WilliamsR *h = wickra_williams_r_new((uintptr_t)14); if (!h) { printf("FAIL WilliamsR: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WilliamsR", &exp); int fails = 0; { const char *nm = wickra_williams_r_name(h); if (!nm || strcmp(nm, "WilliamsR") != 0) { printf("FAIL WilliamsR: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_williams_r_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("WilliamsR", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_williams_r_free(h); return fails; } static int check_WinRate(void) { struct WinRate *h = wickra_win_rate_new((uintptr_t)14); if (!h) { printf("FAIL WinRate: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WinRate", &exp); int fails = 0; { const char *nm = wickra_win_rate_name(h); if (!nm || strcmp(nm, "WinRate") != 0) { printf("FAIL WinRate: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_win_rate_update(h, c); fails += cmp_row("WinRate", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_win_rate_free(h); return fails; } static int check_Wma(void) { struct Wma *h = wickra_wma_new((uintptr_t)14); if (!h) { printf("FAIL Wma: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Wma", &exp); int fails = 0; { const char *nm = wickra_wma_name(h); if (!nm || strcmp(nm, "WMA") != 0) { printf("FAIL Wma: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_wma_update(h, c); fails += cmp_row("Wma", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_wma_free(h); return fails; } static int check_WoodiePivots(void) { struct WoodiePivots *h = wickra_woodie_pivots_new(); if (!h) { printf("FAIL WoodiePivots: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_WoodiePivots", &exp); int fails = 0; { const char *nm = wickra_woodie_pivots_name(h); if (!nm || strcmp(nm, "WoodiePivots") != 0) { printf("FAIL WoodiePivots: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraWoodiePivotsOutput out; if (wickra_woodie_pivots_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.pp; got[gn++] = out.r1; got[gn++] = out.r2; got[gn++] = out.s1; got[gn++] = out.s2; } else { for (int z = 0; z < 5; z++) got[gn++] = NANV; } fails += cmp_row("WoodiePivots", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_woodie_pivots_free(h); return fails; } static int check_YangZhangVolatility(void) { struct YangZhangVolatility *h = wickra_yang_zhang_volatility_new((uintptr_t)20, (uintptr_t)252); if (!h) { printf("FAIL YangZhangVolatility: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_YangZhangVolatility", &exp); int fails = 0; { const char *nm = wickra_yang_zhang_volatility_name(h); if (!nm || strcmp(nm, "YangZhangVolatility") != 0) { printf("FAIL YangZhangVolatility: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_yang_zhang_volatility_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("YangZhangVolatility", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_yang_zhang_volatility_free(h); return fails; } static int check_YoyoExit(void) { struct YoyoExit *h = wickra_yoyo_exit_new((uintptr_t)14, 2.0); if (!h) { printf("FAIL YoyoExit: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_YoyoExit", &exp); int fails = 0; { const char *nm = wickra_yoyo_exit_name(h); if (!nm || strcmp(nm, "YoyoExit") != 0) { printf("FAIL YoyoExit: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_yoyo_exit_update(h, o, hi, lo, c, v, (int64_t)i); fails += cmp_row("YoyoExit", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_yoyo_exit_free(h); return fails; } static int check_ZScore(void) { struct ZScore *h = wickra_z_score_new((uintptr_t)14); if (!h) { printf("FAIL ZScore: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ZScore", &exp); int fails = 0; { const char *nm = wickra_z_score_name(h); if (!nm || strcmp(nm, "ZScore") != 0) { printf("FAIL ZScore: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_z_score_update(h, c); fails += cmp_row("ZScore", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_z_score_free(h); return fails; } static int check_ZeroLagMacd(void) { struct ZeroLagMacd *h = wickra_zero_lag_macd_new((uintptr_t)3, (uintptr_t)7, (uintptr_t)14); if (!h) { printf("FAIL ZeroLagMacd: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ZeroLagMacd", &exp); int fails = 0; { const char *nm = wickra_zero_lag_macd_name(h); if (!nm || strcmp(nm, "ZeroLagMACD") != 0) { printf("FAIL ZeroLagMacd: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraZeroLagMacdOutput out; if (wickra_zero_lag_macd_update(h, c, &out)) { got[gn++] = out.macd; got[gn++] = out.signal; got[gn++] = out.histogram; } else { for (int z = 0; z < 3; z++) got[gn++] = NANV; } fails += cmp_row("ZeroLagMacd", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_zero_lag_macd_free(h); return fails; } static int check_ZigZag(void) { struct ZigZag *h = wickra_zig_zag_new(0.02); if (!h) { printf("FAIL ZigZag: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_ZigZag", &exp); int fails = 0; { const char *nm = wickra_zig_zag_name(h); if (!nm || strcmp(nm, "ZigZag") != 0) { printf("FAIL ZigZag: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; struct WickraZigZagOutput out; if (wickra_zig_zag_update(h, o, hi, lo, c, v, (int64_t)i, &out)) { got[gn++] = out.swing; got[gn++] = out.direction; } else { for (int z = 0; z < 2; z++) got[gn++] = NANV; } fails += cmp_row("ZigZag", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_zig_zag_free(h); return fails; } static int check_Zlema(void) { struct Zlema *h = wickra_zlema_new((uintptr_t)14); if (!h) { printf("FAIL Zlema: new returned NULL\n"); return 1; } double **exp; int rows = read_fixture("g_Zlema", &exp); int fails = 0; { const char *nm = wickra_zlema_name(h); if (!nm || strcmp(nm, "ZLEMA") != 0) { printf("FAIL Zlema: name %s\n", nm ? nm : "(null)"); fails++; } } for (int i = 0; i < N_INPUT; i++) { double o = IN[i][0], hi = IN[i][1], lo = IN[i][2], c = IN[i][3], v = IN[i][4]; (void)o; (void)hi; (void)lo; (void)c; (void)v; double got[128]; int gn = 0; got[gn++] = wickra_zlema_update(h, c); fails += cmp_row("Zlema", i, exp[i], EXPLEN[i], got, gn); } free_fixture(exp, rows); wickra_zlema_free(h); return fails; } int main(int argc, char **argv) { GDIR = (argc > 1) ? argv[1] : "testdata/golden"; load_input(); int total = 0, failed = 0; total++; if (check_AbandonedBaby()) failed++; total++; if (check_Abcd()) failed++; total++; if (check_AbsoluteBreadthIndex()) failed++; total++; if (check_AccelerationBands()) failed++; total++; if (check_AcceleratorOscillator()) failed++; total++; if (check_AdOscillator()) failed++; total++; if (check_AdVolumeLine()) failed++; total++; if (check_AdaptiveCci()) failed++; total++; if (check_AdaptiveCycle()) failed++; total++; if (check_AdaptiveLaguerreFilter()) failed++; total++; if (check_AdaptiveRsi()) failed++; total++; if (check_Adl()) failed++; total++; if (check_AdvanceBlock()) failed++; total++; if (check_AdvanceDecline()) failed++; total++; if (check_AdvanceDeclineRatio()) failed++; total++; if (check_Adx()) failed++; total++; if (check_Adxr()) failed++; total++; if (check_Alligator()) failed++; total++; if (check_Alma()) failed++; total++; if (check_Alpha()) failed++; total++; if (check_AmihudIlliquidity()) failed++; total++; if (check_AnchoredRsi()) failed++; total++; if (check_AnchoredVwap()) failed++; total++; if (check_AndrewsPitchfork()) failed++; total++; if (check_Apo()) failed++; total++; if (check_Aroon()) failed++; total++; if (check_AroonOscillator()) failed++; total++; if (check_Atr()) failed++; total++; if (check_AtrBands()) failed++; total++; if (check_AtrRatchet()) failed++; total++; if (check_AtrTrailingStop()) failed++; total++; if (check_AutoFib()) failed++; total++; if (check_Autocorrelation()) failed++; total++; if (check_AutocorrelationPeriodogram()) failed++; total++; if (check_AverageDailyRange()) failed++; total++; if (check_AverageDrawdown()) failed++; total++; if (check_AvgPrice()) failed++; total++; if (check_AwesomeOscillator()) failed++; total++; if (check_AwesomeOscillatorHistogram()) failed++; total++; if (check_BalanceOfPower()) failed++; total++; if (check_BandpassFilter()) failed++; total++; if (check_Bat()) failed++; total++; if (check_BeltHold()) failed++; total++; if (check_Beta()) failed++; total++; if (check_BetaNeutralSpread()) failed++; total++; if (check_BetterVolume()) failed++; total++; if (check_BipowerVariation()) failed++; total++; if (check_BodySizePct()) failed++; total++; if (check_BollingerBands()) failed++; total++; if (check_BollingerBandwidth()) failed++; total++; if (check_BomarBands()) failed++; total++; if (check_BreadthThrust()) failed++; total++; if (check_Breakaway()) failed++; total++; if (check_BullishPercentIndex()) failed++; total++; if (check_BurkeRatio()) failed++; total++; if (check_Butterfly()) failed++; total++; if (check_CalendarSpread()) failed++; total++; if (check_CalmarRatio()) failed++; total++; if (check_Camarilla()) failed++; total++; if (check_CandleVolume()) failed++; total++; if (check_Cci()) failed++; total++; if (check_CenterOfGravity()) failed++; total++; if (check_CentralPivotRange()) failed++; total++; if (check_Cfo()) failed++; total++; if (check_ChaikinMoneyFlow()) failed++; total++; if (check_ChaikinOscillator()) failed++; total++; if (check_ChaikinVolatility()) failed++; total++; if (check_ChandeKrollStop()) failed++; total++; if (check_ChandelierExit()) failed++; total++; if (check_ChoppinessIndex()) failed++; total++; if (check_ClassicPivots()) failed++; total++; if (check_CloseVsOpen()) failed++; total++; if (check_ClosingMarubozu()) failed++; total++; if (check_Cmo()) failed++; total++; if (check_CoefficientOfVariation()) failed++; total++; if (check_Cointegration()) failed++; total++; if (check_CommonSenseRatio()) failed++; total++; if (check_CompositeProfile()) failed++; total++; if (check_ConcealingBabySwallow()) failed++; total++; if (check_ConditionalValueAtRisk()) failed++; total++; if (check_ConnorsRsi()) failed++; total++; if (check_Coppock()) failed++; total++; if (check_CorrelationTrendIndicator()) failed++; total++; if (check_Counterattack()) failed++; total++; if (check_Crab()) failed++; total++; if (check_CumulativeVolumeDelta()) failed++; total++; if (check_CumulativeVolumeIndex()) failed++; total++; if (check_CupAndHandle()) failed++; total++; if (check_CyberneticCycle()) failed++; total++; if (check_Cypher()) failed++; total++; if (check_DayOfWeekProfile()) failed++; total++; if (check_Decycler()) failed++; total++; if (check_DecyclerOscillator()) failed++; total++; if (check_Dema()) failed++; total++; if (check_DemandIndex()) failed++; total++; if (check_DemarkPivots()) failed++; total++; if (check_DepthSlope()) failed++; total++; if (check_DerivativeOscillator()) failed++; total++; if (check_DetrendedStdDev()) failed++; total++; if (check_DisparityIndex()) failed++; total++; if (check_DistanceSsd()) failed++; total++; if (check_Doji()) failed++; total++; if (check_DojiStar()) failed++; total++; if (check_DollarBars()) failed++; total++; if (check_Donchian()) failed++; total++; if (check_DonchianStop()) failed++; total++; if (check_DoubleBollinger()) failed++; total++; if (check_DoubleTopBottom()) failed++; total++; if (check_DownsideGapThreeMethods()) failed++; total++; if (check_Dpo()) failed++; total++; if (check_DragonflyDoji()) failed++; total++; if (check_DrawdownDuration()) failed++; total++; if (check_DumplingTop()) failed++; total++; if (check_Dx()) failed++; total++; if (check_DynamicMomentumIndex()) failed++; total++; if (check_EaseOfMovement()) failed++; total++; if (check_EffectiveSpread()) failed++; total++; if (check_EhlersStochastic()) failed++; total++; if (check_Ehma()) failed++; total++; if (check_ElderImpulse()) failed++; total++; if (check_ElderRay()) failed++; total++; if (check_ElderSafeZone()) failed++; total++; if (check_Ema()) failed++; total++; if (check_EmpiricalModeDecomposition()) failed++; total++; if (check_Engulfing()) failed++; total++; if (check_Equivolume()) failed++; total++; if (check_EstimatedLeverageRatio()) failed++; total++; if (check_EvenBetterSinewave()) failed++; total++; if (check_EveningDojiStar()) failed++; total++; if (check_Evwma()) failed++; total++; if (check_EwmaVolatility()) failed++; total++; if (check_Expectancy()) failed++; total++; if (check_FallingThreeMethods()) failed++; total++; if (check_Fama()) failed++; total++; if (check_FibArcs()) failed++; total++; if (check_FibChannel()) failed++; total++; if (check_FibConfluence()) failed++; total++; if (check_FibExtension()) failed++; total++; if (check_FibFan()) failed++; total++; if (check_FibProjection()) failed++; total++; if (check_FibRetracement()) failed++; total++; if (check_FibTimeZones()) failed++; total++; if (check_FibonacciPivots()) failed++; total++; if (check_FisherRsi()) failed++; total++; if (check_FisherTransform()) failed++; total++; if (check_FlagPennant()) failed++; total++; if (check_Footprint()) failed++; total++; if (check_ForceIndex()) failed++; total++; if (check_FractalChaosBands()) failed++; total++; if (check_Frama()) failed++; total++; if (check_FryPanBottom()) failed++; total++; if (check_FundingBasis()) failed++; total++; if (check_FundingImpliedApr()) failed++; total++; if (check_FundingRate()) failed++; total++; if (check_FundingRateMean()) failed++; total++; if (check_FundingRateZScore()) failed++; total++; if (check_GainLossRatio()) failed++; total++; if (check_GainToPainRatio()) failed++; total++; if (check_GapSideBySideWhite()) failed++; total++; if (check_Garch11()) failed++; total++; if (check_GarmanKlassVolatility()) failed++; total++; if (check_Gartley()) failed++; total++; if (check_GatorOscillator()) failed++; total++; if (check_GeneralizedDema()) failed++; total++; if (check_GeometricMa()) failed++; total++; if (check_GoldenPocket()) failed++; total++; if (check_GrangerCausality()) failed++; total++; if (check_GravestoneDoji()) failed++; total++; if (check_Hammer()) failed++; total++; if (check_HangingMan()) failed++; total++; if (check_Harami()) failed++; total++; if (check_HaramiCross()) failed++; total++; if (check_HasbrouckInformationShare()) failed++; total++; if (check_HeadAndShoulders()) failed++; total++; if (check_HeikinAshi()) failed++; total++; if (check_HeikinAshiOscillator()) failed++; total++; if (check_HiLoActivator()) failed++; total++; if (check_HighLowIndex()) failed++; total++; if (check_HighLowRange()) failed++; total++; if (check_HighLowVolumeNodes()) failed++; total++; if (check_HighWave()) failed++; total++; if (check_HighpassFilter()) failed++; total++; if (check_Hikkake()) failed++; total++; if (check_HikkakeModified()) failed++; total++; if (check_HilbertDominantCycle()) failed++; total++; if (check_HistoricalVolatility()) failed++; total++; if (check_Hma()) failed++; total++; if (check_HoltWinters()) failed++; total++; if (check_HomingPigeon()) failed++; total++; if (check_HtDcPhase()) failed++; total++; if (check_HtPhasor()) failed++; total++; if (check_HtTrendMode()) failed++; total++; if (check_HurstChannel()) failed++; total++; if (check_HurstExponent()) failed++; total++; if (check_Ichimoku()) failed++; total++; if (check_IdenticalThreeCrows()) failed++; total++; if (check_ImbalanceBars()) failed++; total++; if (check_InNeck()) failed++; total++; if (check_Inertia()) failed++; total++; if (check_InformationRatio()) failed++; total++; if (check_InitialBalance()) failed++; total++; if (check_InstantaneousTrendline()) failed++; total++; if (check_IntradayIntensity()) failed++; total++; if (check_IntradayMomentumIndex()) failed++; total++; if (check_IntradayVolatilityProfile()) failed++; total++; if (check_InverseFisherTransform()) failed++; total++; if (check_InvertedHammer()) failed++; total++; if (check_JarqueBera()) failed++; total++; if (check_Jma()) failed++; total++; if (check_JumpIndicator()) failed++; total++; if (check_KRatio()) failed++; total++; if (check_KagiBars()) failed++; total++; if (check_KalmanHedgeRatio()) failed++; total++; if (check_Kama()) failed++; total++; if (check_KaseDevStop()) failed++; total++; if (check_KasePermissionStochastic()) failed++; total++; if (check_KellyCriterion()) failed++; total++; if (check_Keltner()) failed++; total++; if (check_KendallTau()) failed++; total++; if (check_Kicking()) failed++; total++; if (check_KickingByLength()) failed++; total++; if (check_Kst()) failed++; total++; if (check_Kurtosis()) failed++; total++; if (check_Kvo()) failed++; total++; if (check_KylesLambda()) failed++; total++; if (check_LadderBottom()) failed++; total++; if (check_LaguerreRsi()) failed++; total++; if (check_LeadLagCrossCorrelation()) failed++; total++; if (check_LinRegAngle()) failed++; total++; if (check_LinRegChannel()) failed++; total++; if (check_LinRegIntercept()) failed++; total++; if (check_LinRegSlope()) failed++; total++; if (check_LinearRegression()) failed++; total++; if (check_LiquidationFeatures()) failed++; total++; if (check_LogReturn()) failed++; total++; if (check_LongLeggedDoji()) failed++; total++; if (check_LongLine()) failed++; total++; if (check_LongShortRatio()) failed++; total++; if (check_M2Measure()) failed++; total++; if (check_MaEnvelope()) failed++; total++; if (check_MacdExt()) failed++; total++; if (check_MacdFix()) failed++; total++; if (check_MacdHistogram()) failed++; total++; if (check_MacdIndicator()) failed++; total++; if (check_Mama()) failed++; total++; if (check_MarketFacilitationIndex()) failed++; total++; if (check_MartinRatio()) failed++; total++; if (check_Marubozu()) failed++; total++; if (check_MassIndex()) failed++; total++; if (check_MatHold()) failed++; total++; if (check_MatchingLow()) failed++; total++; if (check_MaxDrawdown()) failed++; total++; if (check_McClellanOscillator()) failed++; total++; if (check_McClellanSummationIndex()) failed++; total++; if (check_McGinleyDynamic()) failed++; total++; if (check_MedianAbsoluteDeviation()) failed++; total++; if (check_MedianChannel()) failed++; total++; if (check_MedianMa()) failed++; total++; if (check_MedianPrice()) failed++; total++; if (check_Mfi()) failed++; total++; if (check_Microprice()) failed++; total++; if (check_MidPoint()) failed++; total++; if (check_MidPrice()) failed++; total++; if (check_MinusDi()) failed++; total++; if (check_MinusDm()) failed++; total++; if (check_ModifiedMaStop()) failed++; total++; if (check_Mom()) failed++; total++; if (check_MorningDojiStar()) failed++; total++; if (check_MorningEveningStar()) failed++; total++; if (check_MurreyMathLines()) failed++; total++; if (check_NakedPoc()) failed++; total++; if (check_Natr()) failed++; total++; if (check_NewHighsNewLows()) failed++; total++; if (check_NewPriceLines()) failed++; total++; if (check_Nrtr()) failed++; total++; if (check_Nvi()) failed++; total++; if (check_OIPriceDivergence()) failed++; total++; if (check_OIWeighted()) failed++; total++; if (check_Obv()) failed++; total++; if (check_OiToVolumeRatio()) failed++; total++; if (check_OmegaRatio()) failed++; total++; if (check_OnNeck()) failed++; total++; if (check_OpenInterestDelta()) failed++; total++; if (check_OpenInterestMomentum()) failed++; total++; if (check_OpeningMarubozu()) failed++; total++; if (check_OpeningRange()) failed++; total++; if (check_OrderBookImbalanceFull()) failed++; total++; if (check_OrderBookImbalanceTop1()) failed++; total++; if (check_OrderBookImbalanceTopN()) failed++; total++; if (check_OrderFlowImbalance()) failed++; total++; if (check_OuHalfLife()) failed++; total++; if (check_OvernightGap()) failed++; total++; if (check_OvernightIntradayReturn()) failed++; total++; if (check_PainIndex()) failed++; total++; if (check_PairSpreadZScore()) failed++; total++; if (check_PairwiseBeta()) failed++; total++; if (check_ParkinsonVolatility()) failed++; total++; if (check_PearsonCorrelation()) failed++; total++; if (check_PercentAboveMa()) failed++; total++; if (check_PercentB()) failed++; total++; if (check_PercentageTrailingStop()) failed++; total++; if (check_PerpetualPremiumIndex()) failed++; total++; if (check_Pgo()) failed++; total++; if (check_PiercingDarkCloud()) failed++; total++; if (check_Pin()) failed++; total++; if (check_PivotReversal()) failed++; total++; if (check_PlusDi()) failed++; total++; if (check_PlusDm()) failed++; total++; if (check_Pmo()) failed++; total++; if (check_PointAndFigureBars()) failed++; total++; if (check_PolarizedFractalEfficiency()) failed++; total++; if (check_Ppo()) failed++; total++; if (check_PpoHistogram()) failed++; total++; if (check_ProfileShape()) failed++; total++; if (check_ProfitFactor()) failed++; total++; if (check_ProjectionBands()) failed++; total++; if (check_ProjectionOscillator()) failed++; total++; if (check_Psar()) failed++; total++; if (check_Pvi()) failed++; total++; if (check_Qqe()) failed++; total++; if (check_Qstick()) failed++; total++; if (check_QuartileBands()) failed++; total++; if (check_QuotedSpread()) failed++; total++; if (check_RSquared()) failed++; total++; if (check_RangeBars()) failed++; total++; if (check_RealizedSpread()) failed++; total++; if (check_RealizedVolatility()) failed++; total++; if (check_RecoveryFactor()) failed++; total++; if (check_RectangleRange()) failed++; total++; if (check_Reflex()) failed++; total++; if (check_RegimeLabel()) failed++; total++; if (check_RelativeStrengthAB()) failed++; total++; if (check_RenkoBars()) failed++; total++; if (check_RenkoTrailingStop()) failed++; total++; if (check_RickshawMan()) failed++; total++; if (check_RisingThreeMethods()) failed++; total++; if (check_Rmi()) failed++; total++; if (check_Roc()) failed++; total++; if (check_Rocp()) failed++; total++; if (check_Rocr()) failed++; total++; if (check_Rocr100()) failed++; total++; if (check_RogersSatchellVolatility()) failed++; total++; if (check_RollMeasure()) failed++; total++; if (check_RollingCorrelation()) failed++; total++; if (check_RollingCovariance()) failed++; total++; if (check_RollingIqr()) failed++; total++; if (check_RollingMinMaxScaler()) failed++; total++; if (check_RollingPercentileRank()) failed++; total++; if (check_RollingQuantile()) failed++; total++; if (check_RollingVwap()) failed++; total++; if (check_RoofingFilter()) failed++; total++; if (check_Rsi()) failed++; total++; if (check_Rsx()) failed++; total++; if (check_RunBars()) failed++; total++; if (check_Rvi()) failed++; total++; if (check_RviVolatility()) failed++; total++; if (check_Rwi()) failed++; total++; if (check_SampleEntropy()) failed++; total++; if (check_SarExt()) failed++; total++; if (check_SeasonalZScore()) failed++; total++; if (check_SeparatingLines()) failed++; total++; if (check_SessionHighLow()) failed++; total++; if (check_SessionRange()) failed++; total++; if (check_SessionVwap()) failed++; total++; if (check_ShannonEntropy()) failed++; total++; if (check_Shark()) failed++; total++; if (check_SharpeRatio()) failed++; total++; if (check_ShootingStar()) failed++; total++; if (check_ShortLine()) failed++; total++; if (check_SignedVolume()) failed++; total++; if (check_SineWave()) failed++; total++; if (check_SineWeightedMa()) failed++; total++; if (check_SinglePrints()) failed++; total++; if (check_Skewness()) failed++; total++; if (check_Sma()) failed++; total++; if (check_Smi()) failed++; total++; if (check_Smma()) failed++; total++; if (check_SmoothedHeikinAshi()) failed++; total++; if (check_SortinoRatio()) failed++; total++; if (check_SpearmanCorrelation()) failed++; total++; if (check_SpinningTop()) failed++; total++; if (check_SpreadAr1Coefficient()) failed++; total++; if (check_SpreadBollingerBands()) failed++; total++; if (check_SpreadHurst()) failed++; total++; if (check_StalledPattern()) failed++; total++; if (check_StandardError()) failed++; total++; if (check_StandardErrorBands()) failed++; total++; if (check_StarcBands()) failed++; total++; if (check_Stc()) failed++; total++; if (check_StdDev()) failed++; total++; if (check_StepTrailingStop()) failed++; total++; if (check_SterlingRatio()) failed++; total++; if (check_StickSandwich()) failed++; total++; if (check_StochRsi()) failed++; total++; if (check_Stochastic()) failed++; total++; if (check_StochasticCci()) failed++; total++; if (check_SuperSmoother()) failed++; total++; if (check_SuperTrend()) failed++; total++; if (check_T3()) failed++; total++; if (check_TailRatio()) failed++; total++; if (check_TakerBuySellRatio()) failed++; total++; if (check_Takuri()) failed++; total++; if (check_TasukiGap()) failed++; total++; if (check_TdCamouflage()) failed++; total++; if (check_TdClop()) failed++; total++; if (check_TdClopwin()) failed++; total++; if (check_TdCombo()) failed++; total++; if (check_TdCountdown()) failed++; total++; if (check_TdDWave()) failed++; total++; if (check_TdDeMarker()) failed++; total++; if (check_TdDifferential()) failed++; total++; if (check_TdLines()) failed++; total++; if (check_TdMovingAverage()) failed++; total++; if (check_TdOpen()) failed++; total++; if (check_TdPressure()) failed++; total++; if (check_TdPropulsion()) failed++; total++; if (check_TdRangeProjection()) failed++; total++; if (check_TdRei()) failed++; total++; if (check_TdRiskLevel()) failed++; total++; if (check_TdSequential()) failed++; total++; if (check_TdSetup()) failed++; total++; if (check_TdTrap()) failed++; total++; if (check_Tema()) failed++; total++; if (check_TermStructureBasis()) failed++; total++; if (check_ThreeDrives()) failed++; total++; if (check_ThreeInside()) failed++; total++; if (check_ThreeLineBreak()) failed++; total++; if (check_ThreeLineBreakBars()) failed++; total++; if (check_ThreeLineStrike()) failed++; total++; if (check_ThreeOutside()) failed++; total++; if (check_ThreeSoldiersOrCrows()) failed++; total++; if (check_ThreeStarsInSouth()) failed++; total++; if (check_Thrusting()) failed++; total++; if (check_TickBars()) failed++; total++; if (check_TickIndex()) failed++; total++; if (check_Tii()) failed++; total++; if (check_TimeBasedStop()) failed++; total++; if (check_TimeOfDayReturnProfile()) failed++; total++; if (check_TowerTopBottom()) failed++; total++; if (check_TpoProfile()) failed++; total++; if (check_TradeImbalance()) failed++; total++; if (check_TradeSignAutocorrelation()) failed++; total++; if (check_TradeVolumeIndex()) failed++; total++; if (check_TrendLabel()) failed++; total++; if (check_TrendStrengthIndex()) failed++; total++; if (check_Trendflex()) failed++; total++; if (check_TreynorRatio()) failed++; total++; if (check_Triangle()) failed++; total++; if (check_Trima()) failed++; total++; if (check_Trin()) failed++; total++; if (check_TripleTopBottom()) failed++; total++; if (check_Tristar()) failed++; total++; if (check_Trix()) failed++; total++; if (check_TrueRange()) failed++; total++; if (check_Tsf()) failed++; total++; if (check_TsfOscillator()) failed++; total++; if (check_Tsi()) failed++; total++; if (check_Tsv()) failed++; total++; if (check_TtmSqueeze()) failed++; total++; if (check_TtmTrend()) failed++; total++; if (check_TurnOfMonth()) failed++; total++; if (check_Tweezer()) failed++; total++; if (check_TwiggsMoneyFlow()) failed++; total++; if (check_TwoCrows()) failed++; total++; if (check_TypicalPrice()) failed++; total++; if (check_UlcerIndex()) failed++; total++; if (check_UltimateOscillator()) failed++; total++; if (check_UniqueThreeRiver()) failed++; total++; if (check_UniversalOscillator()) failed++; total++; if (check_UpDownVolumeRatio()) failed++; total++; if (check_UpsideGapThreeMethods()) failed++; total++; if (check_UpsideGapTwoCrows()) failed++; total++; if (check_UpsidePotentialRatio()) failed++; total++; if (check_ValueArea()) failed++; total++; if (check_ValueAtRisk()) failed++; total++; if (check_Variance()) failed++; total++; if (check_VarianceRatio()) failed++; total++; if (check_VerticalHorizontalFilter()) failed++; total++; if (check_Vidya()) failed++; total++; if (check_VolatilityCone()) failed++; total++; if (check_VolatilityOfVolatility()) failed++; total++; if (check_VolatilityRatio()) failed++; total++; if (check_VoltyStop()) failed++; total++; if (check_VolumeBars()) failed++; total++; if (check_VolumeByTimeProfile()) failed++; total++; if (check_VolumeOscillator()) failed++; total++; if (check_VolumePriceTrend()) failed++; total++; if (check_VolumeProfile()) failed++; total++; if (check_VolumeRsi()) failed++; total++; if (check_VolumeWeightedMacd()) failed++; total++; if (check_VolumeWeightedSr()) failed++; total++; if (check_Vortex()) failed++; total++; if (check_Vpin()) failed++; total++; if (check_Vwap()) failed++; total++; if (check_VwapStdDevBands()) failed++; total++; if (check_Vwma()) failed++; total++; if (check_Vzo()) failed++; total++; if (check_Wad()) failed++; total++; if (check_WavePm()) failed++; total++; if (check_WaveTrend()) failed++; total++; if (check_Wedge()) failed++; total++; if (check_WeightedClose()) failed++; total++; if (check_WickRatio()) failed++; total++; if (check_WilliamsFractals()) failed++; total++; if (check_WilliamsR()) failed++; total++; if (check_WinRate()) failed++; total++; if (check_Wma()) failed++; total++; if (check_WoodiePivots()) failed++; total++; if (check_YangZhangVolatility()) failed++; total++; if (check_YoyoExit()) failed++; total++; if (check_ZScore()) failed++; total++; if (check_ZeroLagMacd()) failed++; total++; if (check_ZigZag()) failed++; total++; if (check_Zlema()) failed++; printf("\nC/C++ golden: %d passed, %d failed (of %d)\n", total - failed, failed, total); return failed ? 1 : 0; }