1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_stochastic_fast( void )
{
/* k=3, offset=k+2=5, y_n=5. %K=80 for all bars (range=5, C-LL=4), %D=SMA(3) of %K=80 */
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 = 80 for all (HH-LL=5, C-LL=4 => 100*4/5=80), %D = SMA(3) of %K = 80 */
fp_t const ek[] = { 80, 80, 80, 80, 80 };
fp_t const ed[] = { 80, 80, 80, 80, 80 };
fp_t const * const exp[2] = { ek, ed };
uint_t k = 3;
return ts_test(ts_stochastic_fast, ts_stochastic_fast_offset, x, exp, sizeof( o ) / sizeof( *o ), (ts_constant_t *)&k, &ts_stochastic_fast_p);
}
|