diff options
| author | Ethan Werner <mail@ethanwerner.com> | 2026-07-01 09:42:39 +0400 |
|---|---|---|
| committer | Ethan Werner <mail@ethanwerner.com> | 2026-07-01 09:42:39 +0400 |
| commit | 07e18043145f3d91c8ea7ec3ad41b3c905585277 (patch) | |
| tree | 2bdeae46973f4bdfce263679a4008ac768011f28 /test/price_channel.c | |
initial commit: ts time series analysis library v0.1.0
- 354 financial and mathematical time-series indicators
- Uniform C11 API with consistent function signatures
- 349 passing tests with -Werror
- Static and shared library builds
- pkg-config integration
- Python bindings
- Fuzzing and sanitizer support
- Security hardening flags
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); +} |