prcroc

Price rate of change

Syntax

proc = prcroc(closep, nTimes)
procts = prcroc(tsobj, nTimes)
procts = prcroc(tsobj, nTimes, ParameterName, ParameterValue)

Arguments

closep

Closing price

nTimes

(Optional) Time difference. Default = 12.

tsobj

Financial time series object

Description

proc = prcroc(closep, nTimes) calculates the price rate of change proc from the closing price closep. If nTimes time is specified, the price rate of change is calculated between the current closing price and the closing price nTimes ago.

procts = prcroc(tsobj, nTimes) calculates the price rate of change procts from the financial time series object tsobj. tsobj must contain a data series named Close. The output procts is a financial time series object with similar dates as tsobj and a data series named PriceROC. If nTimes is specified, the price rate of change is calculated between the current closing price and the closing price nTimes ago.

procts = prcroc(tsobj, nTimes, ParameterName, ParameterValue) specifies the name for the required data series when it is different from the default name. The valid parameter name is

  • CloseName: closing price series name

The parameter value is a string that represents the valid parameter name.

Note, to compute a quantity over n periods, you must specify n+1 for nTimes. If you specify nTimes = 0, the function returns your original time series.

Examples

expand all

Compute the Price Rate of Change

This example shows how to compute the price rate of change for Disney stock and plot the results.

load disney.mat
dis_PriceRoc = prcroc(dis);
plot(dis_PriceRoc)
title('Price Rate of Change for Disney')

References

Achelis, Steven B., Technical Analysis from A to Z, Second printing, McGraw-Hill, 1995, pp. 243 - 245.

See Also

Was this topic helpful?