summaryrefslogtreecommitdiffstats
path: root/test/dx.c
blob: f5ee94c4571e0ea3f8abe1783897ca4b08f91d2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <math.h>
#include <stddef.h>
#include "ts.h"

bool ts_test_dx( void )
{
    fp_t const o[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 };
    fp_t const h[] = { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 };
    fp_t const l[] = { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 };
    fp_t const c[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };

    fp_t const * const x[] = { o, h, l, c };

    /* k=3, all bars identical pattern */
    /* +DM=2, -DM=0, TR=3, EMA values stable at 2, 0, 3 */
    /* +DI=66.667, -DI=0, DX=100 */
    fp_t const e[] = { 100, 100, 100, 100, 100, 100, 100 };
    fp_t const * const exp[1] = { e };

    uint_t k = 3;
    return ts_test(ts_dx, ts_dx_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_dx_p);
}