# How to design more complex Indicator Formulas

## 1. Using Indicator Templates

One way to create more complicated indicator formulas is to use previously created indicator templates. These templates are very similar to what is used for the built-in indicators used for creating basic indicator formulas.

Simple Example: Aroon Oscillator

Aroon Oscillator |
`AROONUPx.z - AROONDOWNx.z` |
`x` =Period, `z` = Offset |

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 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 current Aroon Oscillator 14 can be written as follows.

`AROONUP14.0 - AROONDOWN14.0`

The offset parameter is not essential because it is optional.

`AROONUP14 - AROONDOWN14`

More Complex Example: Keltner Channels

Keltner Channels (Top) |
`tAVG((Hz + Lz + Cz) / 3 + w * ATR1.z, x)` |
`x` =Period, `w` =ATR_Multiplier, `z` =Offset, `t` =AverageType |

The top exponential Keltner Channel 20, 1.50 for the current bar could be written as follows (note the optional parameters are omitted).

`XAVG((H + L + C) / 3 + 1.5 * ATR, 20)`

While a simple upper Keltner Channel 15, 2.00 for the previous bar could be written as follows.

`AVG((H1 + L1 + C1) / 3 + 2 * ATR1.1, 15)`

## 2. Combining formulas using mathematical operators and functions

The two examples above may seem quite different, but what they share in common is using math to transform or combine numbers and built-in indicators to create more complex indicators.

The Personal Criteria Formula Language has a number of built in mathematical operators and functions, including most of the trigonometric and hyperbolic functions.

You may be familiar with most or all of these operators and functions, but the linked tables above (in blue) list the exact syntax to use in PCFs using a format which is similar to what is used for built-in indicators and indicator templates.

The Aroon Oscillator template given above was created using the built-in indicator templates for Aroon Up and Aroon Down.

Aroon Indicator (Down) |
`AROONDOWNx.z` |
`x` =Period, `z` = Offset |

Aroon Indicator (Up) |
`AROONUPx.z` |

And combining them using the template for subtract or difference from the Mathematical Operators and and Functions table.

Subtract or Difference (Mathematical Operator) |
`v - w` |
`v` =Numeric, `w` =Numeric |

Since the Aroon Oscillator is the difference between Aroon Up and Aroon Down, Aroon Up (`AROONUPx.z`

) was substituted for `v`

and Aroon Down (`AROONDOWNx.z`

) was substituted for `w`

in the Subtract or Difference template to get `AROONUPx.z - AROONDOWNx.z`

.

Once you get used to using the mathematical operators and functions you probably aren't going to be using the tables. You may even find it easier to not use the tables at all except as a reference to the exact syntax used for each operator or function in the Personal Criteria Formula Language.