Vector Natural Log

Technical Analysis Indicator: ln

Fork me on GitHub

Function Prototype

/* Vector Natural Log */
/* Type: simple */
/* Input arrays: 1    Options: 0    Output arrays: 1 */
/* Inputs: real */
/* Options: none */
/* Outputs: ln */
int ti_ln_start(TI_REAL const *options);
int ti_ln(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 Natural Log returns the natural logarithm for each element in the input array.

$$ln_{t} = \ln{input_{t}} $$

See Also

References

Example Usage

Calling From C

/* Example usage of Vector Natural Log */
/* 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]; /* ln */

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

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

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

Calling From Lua (with Tulip Chart bindings)

-- Example usage of Vector Natural Log
ln = ti.ln(input)

Example Calculation

dateinputln
2005-11-0181.594.40
2005-11-0281.064.40
2005-11-0382.874.42
2005-11-0483.004.42
2005-11-0783.614.43
2005-11-0883.154.42
2005-11-0982.844.42
2005-11-1083.994.43
2005-11-1184.554.44
2005-11-1484.364.44
2005-11-1585.534.45
2005-11-1686.544.46
2005-11-1786.894.47
2005-11-1887.774.48
2005-11-2187.294.47

Chart

 

Other Indicators

Previous indicator: Linear Regression Slope

Next indicator: Vector Base-10 Log

Random indicator: Triple Exponential Moving Average