TC2000 Help SiteFunctionalityPersonal Criteria Formulas (PCF) BasicsNavigating the PCF Functions, Parameters, and Constants Menu

Navigating the PCF Functions, Parameters, and Constants Menu

This menu is available from anywhere you would edit either a indicator or Condition (boolean) formula. In this example we are using the Indicator (PCF) Formula from the New Menu. This article will walk you through the functionality of each of the menu items and conclude with an example of these items in use. Please refer to the help articles on Constants, Parameters and Functions for more specific details on each of those items.

Click on the hamburger button to open the menu.  

This opens a menu which allows you to choose from several items to add to your formula

The first item allows you to add a parameter to your formula

Click on Add parameter and this dialog box will appear

This dialog allows you to name your parameter, assign it a default value, and add a tagged description of what that parameter does, in this example we will name it "Period" give it a value of "20" and set the description to "Defines number of bars in period"

Select OK to add it to the PCF editor window

This is how a parameter will appear in the editor window

Please note that Parameters must always be entered above the formula, you can also type in the parameter using the above syntax instead of adding it using the menu button.

The next item in the menu allows you to add a Constant to your formula

Selecting Add Constant will make this dialog appear

This dialog allows you to name your constant, assign it a default value, and add a tagged description of what that constant does, in this example we will name it "OHLC" give it a value of "C" and set the description to "Defines part of bar used, can be O,H,L or C"

Select OK to add it to the PCF editor window

This is how a constant will appear in the editor window

Please note that Constants must always be entered above the formula, you can also type in the constant using the above syntax instead of adding it using the menu button.

The third item in the menu allows you to add a new Function (from scratch) to the formula

Click on Add New Function and a new PCF editor window will appear

The <desc> and <tag> comment lines allow you to add a description of what your function does and ad searchable tags to your function. In this example we will name the function "MaxHigh" add "Returns the maximum High value of the last 20 bars" to the description and "20 Highs" to the tag line. We will enter in the formula: MAXH20

We are going to save this formula for later use by clicking on the hamburger button and selecting Save formula

You can name the formula whatever you like but for continuity we are going to save it as MaxHigh20, once named click the save button

Once you have (optionally) saved the formula click OK to add it to your formula window

The function has now been added to the formula window

The Fourth item in the menu allows you to open an already saved function

Selecting Add Function from Library... will open the formula library

In this example we will load the previously saved formula MaxHigh20, please note that searching for the formula name MaxHigh20 or the tag that we assigned to it "20 Highs" will return it in the results

Select the formula from the results

This will open that formula in an editor window, select OK to add it to your main formula

The function is now available for use

The last item in the menu opens a the formula in a larger standalone editor window  

Selecting Edit in standalone window pops out a larger formula editor window with the same functionality as the standard editor.

Tying it all together

We will now show how to call the function, parameter and constant in an example formula that describes where the current price "C" is relative to the maximum high and minimum low of the last 20 bars and creates and average of that value. Please note that the purpose of this formula is to show how these items can be utilized and should not be considered a recommended indicator in any way. The formula we will be creating is:
AVG(((MAXH20)  - C) / (C - MINL20), 20)

First add the function Avg to the formula followed by two opening parentheses

Note that as you type the code completion gives you a list of available functions and declarations as well as a description of that function. You can use the up and down arrows to move through the list of functions, pressing enter will select the highlighted function.

Next we will call the MaxHigh function

User Functions, Parameters, and Constants all begin with the pound sign "#"

Note the description for this function is what was entered between the <desc> tags previously

Now we will add a minus sign and call our OHLC constant then add a closing parentheses

Note the description of the constant matches what is placed between the <desc> tags to the right of the defined constant

Next we will add a division sign and subtract the 20 period minimum low from our OHLC constant

MINL20 could have been saved as it's own user defined function, it was entered this way to show the use of user defined functions and system functions.

Finally we will call our period parameter to define the period of the average and add the final closing parentheses to complete the formula

Note the description of the parameter matches what is placed between the <desc> tags to the right of the defined parameter

You can view the flattened formula (once there are no formula errors)  by clicking the blue magnifying glass icon

This shows that our Parameter, Constant and function were all passed through correctly

We can change our Parameter value to 50 and Constant value to O in the heading and see how they change the formula