math.log

The natural logarithm of number: its logarithm to base e. It is defined for a number greater than zero. This is the only logarithm in the namespace. There is no base-10 logarithm, and a script that calls one fails.

math.log(const float number) → const float
math.log(input float number) → input float
math.log(series float number) → series float
math.log(simple float number) → simple float
ParameterTypeRequiredDescription
numberconst floatyesThe number to take the natural logarithm of.

Returns const float or input float or series float or simple float — The natural logarithm, as a float in the argument’s form.

indicator("Log price")
plot(math.log(close))

See also math.abs · math.acos · math.asin

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade