talib.MULT
Multiplies two arrays element by element (Vector Arithmetic Mult).
talib.MULT(inReal0, inReal1)Examples
Multiply the close price of each K-line by its volume.
javascript
function main() {
var records = exchange.GetRecords()
if (!records) return
// close price multiplied by volume
var closes = records.map(function(r) { return r.Close })
var volumes = records.map(function(r) { return r.Volume })
var ret = talib.MULT(closes, volumes)
Log(ret)
}
python
import talib
def main():
records = exchange.GetRecords()
if not records:
return
# close price multiplied by volume
ret = talib.MULT(records.Close, records.Volume)
Log(ret)Returns
| Type | Description |
numeric array | Results, the same length as the input. |
Arguments
| Name | Type | Required | Description |
inReal0 | numeric array | Yes | First series. |
inReal1 | numeric array | Yes | Second series; it must have the same length as |
See Also
Remarks
TA-Lib equivalent: MULT(Array(inReal0),Array(inReal1)) = Array(outReal).
Calculates inReal0[i] * inReal1[i] element by element.
In JavaScript, both inputs must be numeric arrays (extract a field from the K-line data with map first): if a K-line array is passed, both inputs take the close price of the same K-line data and the result is meaningless; arrays of different lengths raise an error.