Built-in Functions
Structures
Built-in Variables and Constants
Conventions
Exchanges
talib.COS
Calculates the cosine of each element (Vector Trigonometric Cos).
talib.COS(inReal)Examples
Compute the cosine of a few numbers.
javascript
function main() {
var data = [-3.14, 0, 3.14]
var ret = talib.COS(data)
// Output: about [-1, 1, -1]
Log(ret)
}
python
import talib
import numpy as np
def main():
data = [-3.14, 0, 3.14]
ret = talib.COS(np.array(data))
# Output: about [-1, 1, -1]
Log(ret)Returns
| Type | Description |
numeric array | Results, the same length as the input. |
Arguments
| Name | Type | Required | Description |
inReal |
| Yes | K-line array (close prices are used) or numeric array; in Python, pass a numeric array such as |
See Also
Remarks
TA-Lib equivalent: COS(Records[Close]) = Array(outReal).