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

bool ts_test_price_channel( void )
{
    fp_t const x[] = { 10, 12, 11, 14, 13, 15, 16, 14, 17, 18 };
    fp_t const * const inp[1] = { x };

    /* k=3, offset=2, y_n=8 */
    /* HH3: 12,14,14,15,16,16,17,18 */
    /* LL3: 10,11,11,13,13,14,14,14 */
    /* SMA3: 11,12.333,12.667,14,14.667,15,15.667,16.333 */
    fp_t const eu[] = { 12, 14, 14, 15, 16, 16, 17, 18 };
    fp_t const em[] = { 11, 12.33333, 12.66667, 14, 14.66667, 15, 15.66667, 16.33333 };
    fp_t const el[] = { 10, 11, 11, 13, 13, 14, 14, 14 };
    fp_t const * const exp[3] = { eu, em, el };

    uint_t k = 3;
    return ts_test(ts_price_channel, ts_price_channel_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&k, &ts_price_channel_p);
}