All Math Functions

You are here:
< All Topics

ABS Function

The ABS function returns the absolute value for a number. Negative numbers become positive and positive numbers remain positive. 

Example: ABS(CLOSE – OPEN) 

The script always evaluates to a positive number, even if the opening price is greater than the closing price. 

SIN Function

The SIN function returns the sine for a number (angle). 

Example: SIN(45) 

The script outputs 0.851

COS Function

COS returns the cosine for a number (angle). 

Example: COS(45) 

The script outputs 0.525

TAN Function

The TAN function returns the tangent for a number (angle). 

Example: TAN(45) 

The script outputs 1.619

ATN Function

Returns the arctangent for a number. 

Example: ATN(45) 

The script outputs 1.548

EXP Function

EXP raises to the power of a number. The LOG function is the reverse of this function. 

Example: EXP(3.26) 

The script outputs 26.28

LOG Function

Returns the natural logarithm of a positive number. The EXP function is the reverse of this function. Also see LOG10. 

Example: LOG(26.28) 

The script outputs 3.26

LOG10 Function

Returns the base 10 logarithm of a positive number. Also see LOG.

Example: LOG10(26.28) 

The script outputs 1.42

RND Function

The RND function returns a random number from 0 to a maximum value.

Example: RND(100) 

Outputs a random number from 0 to 100.

Next Math Functions Introduction
Table of Contents