Returns the base-10 logarithm of a number: the power of 10 that gives it.
math.log10(1000) is 3 because 10 to the power of 3 is 1000. It is defined for positive numbers and gives na for negatives.
It counts digits: math.floor(math.log10(volume)) + 1 is the number of digits in a whole-number volume.
Syntax
math.log10(number: simple int/float) -> simple float
math.log10(number: input int/float) -> input float
math.log10(number: const int/float) -> const float
math.log10(number: series int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| number | const/ | required | The number to take the base-10 logarithm of. 0 or below gives na. |
Returns
const/input/simple/series float: the base-10 logarithm.
Remarks
- Use it to compress series that span many orders of magnitude, such as volume.
Example
//@version=6
indicator("Log volume")
plot(math.log10(volume + 1), "log10 volume", color = color.teal, style = plot.style_area)See also
Runs on Sidechair