Custom - CUS

Description:

Allows the user to create custom indicators to plot. The user builds an indicator in a step by step manner.
By using all the indicator plugins available, we are able to build most any kind of indicator quickly and simply. Complicated, intensive indicators would best be left to creating a plugin instead of long series of functions for speed and memory considerations.

Formula Page:



This is where we enter our script. We break our script down into steps. Each step basically defines a  variable. Each variable represents the results of an indicator command. The format of the variable command is:

<variable> := <indicator>(indicator parameters)


Here is an example of what the MACD indicator would look like if we constructed one manually instead of using the builtin version.

macd := TALIB(MACDFIX, Close, 9, 1)
trig := TALIB(EMA, macd, 9)
osc := UTIL(SUB, macd, trig)

Lets review what we did. The first line creates a variable called 'macd'. We use the TALIB indicator to get a MACD using the MACDFIX function. The next line we create a variable called 'trig'. This will be the trigger of the MACD, which is just an EMA of the MACD. So we use the TALIB plugin again and request an 9 period EMA of the 'macd'. Notice we use the variable 'macd' as the input for the 'trig'. The last line we create a variable called 'osc'. This is an oscillator. An oscillator is simply the difference between 2 variables. So we need to use the UTIL plugin that contains a subtraction (SUB) function. We input the parms to get an oscillator of (macd - trig). That's it.

Fortunately, we do not have to input all the parms manually. We can use the function dialog gui to construct the script for us.

For a description of some types used. See here.

Plot Page:



On this page we decide which variables from the formula page we choose to plot on our chart. Each plot command has 4 parameters. The format of the plot command is:

plot (<var>, <color>, <title>, <plot type>)

  1. <var> - This is the variable name used in the formula page.
  2. <color> - The color the plot should use.
  3. <title> - The text label the plot will use.
  4. <plot type> - The plot type to use. ie Line, Histogram etc.

From our MACD example it looks like this:

plot(osc, blue, OSC, Histogram)
plot(macd, red, MACD, Line)
plot(trig, yellow, TRIG, Dash)

Notice we plot the osc variable first. We do this so the histogram does not obscure the macd and trig plots.
Fortunately, the user does not need to input the plot format manually. We can use the 'insert' dialog to construct the plot paramaters for us correctly.

Reserved Words:

These words and symbols are reserved for use in CUS scripts. Do not use these words and symbols in or part of variable names or the script will fail or become unstable.

:=
plot
Date, Open, High, Low, Close, Volume, Open Interest, Day, Week, Month, DayOfWeek


BackNextHome