1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <math.h>
#include <stddef.h>
#include "ts.h"
bool ts_test_dpo( void )
{
fp_t const x[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
fp_t const * const inp[1] = { x };
/* k=4, offset=3 */
/* SMA4: 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5 */
/* DPO[3] = close[3] - SMA4[0] = 4 - 2.5 = 1.5 */
/* DPO[4] = close[4] - SMA4[1] = 5 - 3.5 = 1.5 */
/* ... all 1.5 */
fp_t const e[] = { 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5 };
fp_t const * const exp[1] = { e };
uint_t c_val = 4;
return ts_test(ts_dpo, ts_dpo_offset, inp, exp, sizeof( x ) / sizeof( *x ), (ts_constant_t *)&c_val, &ts_dpo_p);
}
|