# How to Design Basic Indicator Formulas (PCFs)

This article is about designing your own Personal Criteria Formula from scratch. If you are typing in or copying and pasting a formula designed by somebody else, instructions on how to enter and save the formula can be found by clicking here.

The easiest formulas to create are simple indicator formulas based on price and volume. An indicator formula for the current price or close of the current bar is just a single letter that just so happens to be the first letter in both current and close.

`C`

The same is true for the open, high, low, and even volume. You can just use the first letter of the name to create a simple indicator for that component. So open is:

`O`

High is:

`H`

Low is:

`L`

And Volume is:

`V`

All formulas are created with periods and settings using bars or candles. The time frame used will be based on the time frame set for the Personal Criteria Formula or the time frame of the chart if the formula is being used in a Custom PCF Indicator.

## 2. Past values and the offset parameter

While most other indicators (which will be explored later) have other parameters as well, the only parameter for price and volume is the *Offset *parameter.

The offset parameter specifies the number of bars ago for which you wish to get a value with the current bar being zero and the previous bar being one. So the current price can be expressed in a PCF as:

`C`

Or by putting a zero offset inside parentheses:

`C(0)`

Or by putting a zero offset immediately to the right of C:

`C0`

All of the above would return the same value because zero bars ago is the current bar.

If we wanted to get the high of the bar from 10 bars ago, we would set the offset parameter to 10. So we could use:

`H(10)`

Or:

`H10`

## 3. Other Parameters and Built-in Indicators

Let's look at the entry for Bollinger Band (Top).

Bollinger Band (Top) |
`BBTOP(d, x, z)` |
`d` =StdDev, `x` =Period, `z` =Offset |

`BBTOPd.x.z` |
`d` =StdDev (integer only), `x` =Period, `z` =Offset |

The two templates are mostly the same. As with price, there is a version using parentheses and a version without the parentheses.

You need to substitute numbers (and sometimes even other formulas) for the parameters in order to create an actual formula using the template given in the table.

Tip: The name of the indicator in blue in the table is a link to an article about that indicator which will have an expandable section called *Custom PCF Formula* which may include additional information about creating formulas for this indicator.

The version with parentheses has the parameters separated by commas and can have spaces between the parameters (but not between the BBTOP keyword and the opening parenthesis). So the top simple Bollinger Band with a period of 20 and standard deviation setting of 2.0 can be written as follows.

`BBTOP(2, 20)`

Note that the standard deviation setting comes first even though Bollinger Bands would more traditionally be written with the period first and that the offset setting is not used at all (because it is optional).

The top band of simple Bollinger Bands 10, 1.5 from the previous bar could be written as follows.

`BBTOP(1.5, 10, 1)`

The version without parentheses has the parameters separated by periods and cannot have any spaces in it at all. So the top simple Bollinger Band 20, 2.0 from above could be written as follows.

`BBTOP2.20`

The fact that it uses periods to separate the parameters means there is no way to include a number with a period as the decimals marker either which is why this version can only use integer multiples of standard deviation to set its width. So the simple top Bollinger Bands 10, 1.5 cannot be recreated from the previous bar given above, but the previous value of the simple Bollinger Bands 20, 2.0 can be used from the previous bar using this syntax.

`BBTOP2.20.1`

*Indicator formulas for other indicators with built-in syntax can be created the same way. *You can find a list of other indicators besides price and volume with syntax built into the Personal Criteria Formula Language by clicking here.