PercentChange (Function)

image\trumpet2.gif Disclaimer

The PercentChange function calculates the percent change in price of the current bar over the price length bars ago.

Syntax

PercentChange(Price, Length)

Returns (Double)

A numeric value containing the percent change in price of the current bar over the price length bars ago.

Parameters

Name

Type

Description

Price

Numeric

Specifies which bar value (price, function, or formula) to be considered.

Length

Numeric

Sets the number of bars to be considered.

Remarks

PercentChange takes the difference in between the current value of Price and the Price specified by Length bars ago, and then divides the result by the Price of Length bars ago.

Example

PercentChange(Close, 14)

If the above returns a value of 0.35, there was a 35% increase in the closing price of the current bar compared to the closing price of 14 bars ago.

PercentChange(High, 25);

returns a value of -0.15 indicating that there was a 15% decrease in the High price of the current bar compared to the High price of 25 bars ago.

Additional Example

You could use the PercentChange function to alert you when the closing price has increased 10% from the closing price of 10 bars ago by using the following syntax:

Value1 = PercentChange(Close, 10); 

Plot1(Value1, "PrctChange");

If Value1 >= .10 Then
 Alert
;