math.pow

base raised to the power of exponent. The language has no exponentiation operator: a token for one exists in the lexer but no rule reaches it, so source containing ^ does not parse. This function is how you raise a number to a power.

math.pow(const float base, const float exponent) → const float
math.pow(input float base, input float exponent) → input float
math.pow(series float base, series float exponent) → series float
math.pow(simple float base, simple float exponent) → simple float
ParameterTypeRequiredDescription
baseconst floatyesThe number to raise.
exponentconst floatyesThe power to raise it to.

Returns const float or input float or series float or simple float — The result, as a float in the arguments’ form.

indicator("Close squared")
plot(math.pow(close, 2))

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