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.
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"
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)
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.
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
Note the description of the constant matches what is placed between the <desc> tags to the right of the defined 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