Function Prototype
/* Qstick */
/* Type: indicator */
/* Input arrays: 2 Options: 1 Output arrays: 1 */
/* Inputs: open, close */
/* Options: period */
/* Outputs: qstick */
int ti_qstick_start(TI_REAL const *options);
int ti_qstick(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.
Qstick can be used to quantify the ratio of recent up-bars to down-bars.
Qstick takes one parameter, the period n
.
It is calculated for each bar as follows:
$$qstick_{t} = \frac{1}{n} \sum_{i=0}^{n-1} close_{t-i} - open_{t-i}$$
See Also
References
- Chande, Tushar S. (1994) The New Technical Trader
- Achelis, S. (2000) Technical Analysis from A to Z, 2nd Edition
Example Usage
Calling From C
/* Example usage of Qstick */
/* Assuming that 'open' and 'close' are pre-loaded arrays of size 'in_size'. */
TI_REAL *inputs[] = {open, close};
TI_REAL options[] = {5}; /* period */
TI_REAL *outputs[1]; /* qstick */
/* Determine how large the output size is for our options. */
const int out_size = in_size - ti_qstick_start(options);
/* Allocate memory for output. */
outputs[0] = malloc(sizeof(TI_REAL) * out_size); assert(outputs[0] != 0); /* qstick */
/* Run the actual calculation. */
const int ret = ti_qstick(in_size, inputs, options, outputs);
assert(ret == TI_OKAY);
Calling From Lua (with Tulip Chart bindings)
-- Example usage of Qstick
qstick = ti.qstick(open, close, 5)
Example Calculation
period = 5
date | open | close | qstick |
---|---|---|---|
2005-11-01 | 81.85 | 81.59 | |
2005-11-02 | 81.20 | 81.06 | |
2005-11-03 | 81.55 | 82.87 | |
2005-11-04 | 82.91 | 83.00 | |
2005-11-07 | 83.10 | 83.61 | 0.30 |
2005-11-08 | 83.41 | 83.15 | 0.30 |
2005-11-09 | 82.71 | 82.84 | 0.36 |
2005-11-10 | 82.70 | 83.99 | 0.35 |
2005-11-11 | 84.20 | 84.55 | 0.40 |
2005-11-14 | 84.25 | 84.36 | 0.32 |
2005-11-15 | 84.03 | 85.53 | 0.68 |
2005-11-16 | 85.45 | 86.54 | 0.87 |
2005-11-17 | 86.18 | 86.89 | 0.75 |
2005-11-18 | 88.00 | 87.77 | 0.64 |
2005-11-21 | 87.60 | 87.29 | 0.55 |
Chart
Other Indicators
Previous indicator: Positive Volume Index
Next indicator: Rate of Change
Random indicator: Money Flow Index
Copyright © 2016-2024 Tulip Charts LLC. All Rights Reserved.