Returns the smallest of the numbers you pass; na if any of them is na.
math.min compares two or more numbers on the current bar and returns the smallest. Any count of arguments is allowed, and mixed ints and floats give a float.
It works across arguments on one bar, not across bars. For a rolling minimum use ta.lowest, and for the smallest value on record use ta.min.
Syntax
math.min(number0, number1, ...: const int) -> const int
math.min(number0, number1, ...: const int/float) -> const float
math.min(number0, number1, ...: simple int) -> simple int
math.min(number0, number1, ...: simple int/float) -> simple float
math.min(number0, number1, ...: input int) -> input int
math.min(number0, number1, ...: input int/float) -> input float
math.min(number0, number1, ...: series int) -> series int
math.min(number0, number1, ...: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| number0, number1, ... | const int or const int/ | required | Two or more numbers to compare. |
Returns
const int or const float or simple int or simple float or input int or input float or series int or series float: the smallest argument.
Remarks
math.min(x, cap)limits a value to an upper bound.- An na argument makes the result na.
Example
//@version=6
indicator("Capped volume ratio")
ratio = volume / ta.sma(volume, 20)
plot(math.min(ratio, 3), "Ratio (max 3)", color = color.blue, style = plot.style_histogram)See also
Runs on Sidechair