Select Page

What's the difference between the ROC() and CHANGE() functions?

Optuma Forums Optuma Scripting What's the difference between the ROC() and CHANGE() functions?

This topic contains 1 reply, has 1 voice, and was last updated by  Darren 2 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
• Author
Posts
• #44607

Darren
• Topics: 29
• Replies: 164
• Posts: 193

The Rate of Change ROC() and CHANGE() functions are essentially the same (ie they calculate the % change over a user-defined lookback period). For example, the following columns on a daily watchlist will give the same values using the different functions. (Note that ROC(BARS=5) will only be the same as CHANGE(INT_TYPE=Week) in a 5 day trading week.)

However, the results will be different when changing timeframes.

For example, ROC(Week(PERIODAMOUNT=1), BARS=1) uses weekly data, so will use the previous week’s (Friday) close to calculate the percentage change, whereas CHANGE(INT_TYPE=Week) will be a rolling weekly change, ie, Monday to Monday, Wednesday to Wednesday, etc.

As such, when viewed on a Friday both will have the same values – as long as the markets were open on Friday – but on a Wednesday the ROC(Week(PERIODAMOUNT=1), BARS=1) function will show the performance of just the current week (since Friday) and the CHANGE(INT_TYPE=Week) will calculate Wednesday to Wednesday.

Here’s an example comparing the two in a watchlist column and Time Price Measure tool on the chart of XIJ (notice the Bars and Days counts).

#48819

Darren
• Topics: 29
• Replies: 164
• Posts: 193

Following up on this thread, here’s how to calculate a rolling week’s performance, this week’s performance, last week’s performance, and the week before that.

Rolling week (eg Tuesday to Tuesday): CHANGE(INT_TYPE=Week)

This week (since last Friday): ROC(Week(PERIODAMOUNT=1), BARS=1)

Last week: CHANGE(Week(PERIODAMOUNT=1), INT_TYPE=Week)[1]

Two weeks ago: CHANGE(Week(PERIODAMOUNT=1), INT_TYPE=Week)[2]

Note that to display as a percentage in a watchlist column divide each of the above by 100 (ie CHANGE(INT_TYPE=Week) / 100) and then right-click on the column heading and change the Column Type to Percentage. The cells can also be conditionally coloured under Custom Labels: