Pow
Pow in ProBuilder raises a base value to an exponent, computing base to the power. Argument order, syntax, link to SQRT and SQUARE, and worked examples.
Syntax
POW(BaseValue, Power)Parameters
| Name | Type | Description |
|---|---|---|
BaseValue | number | The base to be raised. |
Power | number | The exponent the base is raised to. Can be a whole number or a fraction. |
Formula
POW(x, y) = x^yPOW(2, 3) is 8, POW(9, 0.5) is 3 (the square root), and POW(x, 0) is 1 for any non-zero base.
How it works
POW raises the first argument to the power of the second. Argument order matters: POW(2, 3) is 8 but POW(3, 2) is 9. A whole-number exponent gives repeated multiplication, while a fractional exponent gives a root, so POW(x, 0.5) equals SQRT(x) and POW(x, 2) equals SQUARE(x).
For the fixed base e, EXP is the specialized function. POW covers any base, which is useful for compounding at an arbitrary rate or for custom power weightings.
Examples
Example 1, Two cubed (Indicator)
// Raise 2 to the power of 3
result = POW(2, 3) // 8
RETURN result AS "2^3"The base 2 is raised to the exponent 3, giving 8. Swapping the arguments would return 9 instead.
Example 2, Cube a normalized ratio (ProScreener)
// Emphasize large ratios by cubing them
ratio = close / Average[50](close)
cubed = POW(ratio, 3)
SCREENER[cubed > 1.2](cubed AS "Ratio cubed")Cubing amplifies values above 1 and shrinks values below it, sharpening the separation between strong and weak instruments.
Example 3, Compound a per-bar growth rate (ProOrder)
// Project a fixed daily growth rate over 5 bars
rate = 1.002
factor = POW(rate, 5)
IF NOT LongOnMarket AND close > close[5] * factor THEN
BUY 1 CONTRACT AT MARKET
ENDIFPOW(rate, 5) compounds the per-bar rate across five bars, giving the growth factor the current price is compared against.
Common errors and gotchas
- Base first, exponent second.
POW(2, 3)is 8,POW(3, 2)is 9. Swapping the arguments changes the result. - Fractional exponents are roots.
POW(x, 0.5)is the square root ofxand is only real forx >= 0, the same domain limit asSQRT. - Uppercase name in code. The documented display name is
Pow, but the call is writtenPOW(...). ProBuilder keywords are not case sensitive, so either casing works.
