TC2000 Help SitePersonal Criteria Formulas (PCF) Designing your own PCFsHow to use Net and Percent Difference in Formulas

# How to use Net and Percent Difference in Formulas

Net Difference is simply subtracting one value from another value.

The Percent Difference reflects the same thing as a percentage of something. You need to ask yourself, "As a percentage of what?", and use that as the basis for your calculations.

The Percent Difference is 100 times the  Net Difference  divided by whatever you are using as a basis for your calculations.

The simplest examples of this are exemplified by two built in indicators which you could use without formulas called Rate of Change & Rate of Change Percent.

In many cases you will be able to use these indicators instead of creating formulas, but you may need to change the data source for the indicator if the difference over time is of something other than price.

The Net Difference for the rate of change is just price minus the closing price a number of bars ago given by the period.

## Rate of Change

 ROC `Cz - Cy` `x`=Period`y`=`x+z``z`=Offset

Where `x` is the period which must be an integer.

Where `y` is `x + z`.

Where `z` is the offset. An offset of 1 would be 1 bar ago.

## Examples

A 50 period rate of change can be written as follows.

`C - C50`

A 50 period rate of change being less than \$1 can be written as follows.

`C - C50 < 1`

A 50 period rate of change from 1 bar ago can be written as follows.

`C1 - C51`

A 50 period rate of change from 3 bars ago being at least \$5 can be written as follows.

`C3 - C53 >= 5`

The Percent Difference in going to be the Net Difference divided by a basis. In this case the basis is going to be the closing price a number of bars ago given by the period.

## Rate of Change Percent

 ROC% `100 * (Cz - Cy) / Cy` `x`=Period`y`=`x+z``z`=Offset `100 * (Cz / Cy - 1)`

Where `x` is the period which must be an integer.

Where `y` is `x + z`.

Where `z` is the offset. An offset of 1 would be 1 bar ago.

## Examples

A 50 period rate of change percent can be written as follows.

`100 * (C / C50 - 1)`

A 50 period rate of change being less than 3% can be written as follows.

`100 * (C / C50 - 1) < 3`

A 50 period rate of change from 1 bar ago can be written as follows.

`100 * (C1 / C51 - 1)`

A 50 period rate of change from 3 bars ago being at least 1% can be written as follows.

`100 * (C3 / C53 - 1) >= 1`