diff options
Diffstat (limited to 'test/price_channel.c')
| -rw-r--r-- | test/price_channel.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/price_channel.c b/test/price_channel.c new file mode 100644 index 0000000..ba16e69 --- /dev/null +++ b/test/price_channel.c @@ -0,0 +1,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); +} |