Vector Degree Conversion

Technical Analysis Indicator: todeg

Fork me on GitHub

Function Prototype

/* Vector Degree Conversion */
/* Type: simple */
/* Input arrays: 1    Options: 0    Output arrays: 1 */
/* Inputs: real */
/* Options: none */
/* Outputs: degrees */
int ti_todeg_start(TI_REAL const *options);
int ti_todeg(int size,
      TI_REAL const *const *inputs,
      TI_REAL const *options,
      TI_REAL *const *outputs);

Description

This documentation is still a work in progress. It has omissions, and it probably has errors too. If you see any issues, or have any general feedback, please get in touch.

Vector Degree Conversion converts an input array of radians into an array of degrees.

$$todeg_{t} = input_{t} \cdot \frac{180}{\pi}$$

See Also

References

Example Usage

Calling From C

/* Example usage of Vector Degree Conversion */
/* Assuming that 'input' is a pre-loaded array of size 'in_size'. */
TI_REAL *inputs[] = {input};
TI_REAL options[] = {}; /* No options */
TI_REAL *outputs[1]; /* degrees */

/* Determine how large the output size is for our options. */
const int out_size = in_size - ti_todeg_start(options);

/* Allocate memory for output. */
outputs[0] = malloc(sizeof(TI_REAL) * out_size); assert(outputs[0] != 0); /* degrees */

/* Run the actual calculation. */
const int ret = ti_todeg(in_size, inputs, options, outputs);
assert(ret == TI_OKAY);

Calling From Lua (with Tulip Chart bindings)

-- Example usage of Vector Degree Conversion
degrees = ti.todeg(input)

Example Calculation

dateinputdegrees
2005-11-010.2011.46
2005-11-020.3017.19
2005-11-030.4022.92
2005-11-040.3017.19
2005-11-070.5028.65
2005-11-080.7040.11
2005-11-090.7542.97
2005-11-100.9051.57
2005-11-110.9051.57
2005-11-141.0057.30
2005-11-151.0057.30
2005-11-160.2011.46
2005-11-170.105.73
2005-11-18-0.10-5.73
2005-11-21-0.50-28.65

Chart

 

Other Indicators

Previous indicator: Triple Exponential Moving Average

Next indicator: Vector Radian Conversion

Random indicator: Linear Regression Intercept