Creating custom indicators

Once the concept behind a trading indicator has been defined, traders must decide how the indicator should appear. Indicators can take on many different forms and it’s up to the trader to determine which method is most visually effective for displaying the concept. Indicators can appear on a price chart in many different ways:

As a separate study below a price chart (think Stochastic or CCI)

Lines overlaid on top of price (such as moving averages or Bollinger bands)

Dots or arrows projected over price bars

Differently colored price bars

Text, lines or other annotations added to a price chart

The goal of an effective indicator is to highlight the condition or conditions defining the trading concept or calculation. A good trading indicator will provide the trader with a clear and unique visual representation of trading activity that may not have been evident from a price chart alone. Traders should be careful, however, not to add too many indicators to a chart. This can become confusing or detract from the most important part of a chart: The price.

The Volumizer indicator comprises two components: The 40-day average price and the 40-day relative average volume. We overlay both on the same price chart. Because we are looking for differences between price and volume, we highlight the area between the average price and relative average volume. To accomplish this, we color the area blue to reflect instances where average price crosses above the relative average volume, and red when average price crosses below relative average volume. This way, it should be easy to recognize the ideal conditions in an attempt to substantiate the concepts of the indicator.

Writing the code

Most system trading platforms use their own proprietary programming language, and traders either can write the code for the indicator themselves or work with a qualified programmer. The code is simply a list of instructions that must be written in an exact format. Each horizontal line of code, referred to as a statement, gives the computer a different command; these statements form the building blocks of the program.

While the actual programming falls outside the scope of this article—and, in any case, will vary depending on what system you employ— generally it is helpful to use a structured approach to programming that breaks the code down into three sections:

The declaration (or program header): Assigns values to the variables of the program, including user-definable input variables

The calculation block: The math behind the indicator

The plotting instructions: Tell the program which calculations to plot and how they are to be displayed

Traders who decide to work with a programmer can save (sometimes significant) time and money by providing the programmer with exact specifications for the project. Programmers generally frown upon subjective or vague instructions, and instead require objective rules to code an indicator efficiently and accurately.

In addition to the indicator’s function, it is important to specify how it should look. Any specific variables for which traders would like to be able to change values, such as lookback period or price type (open, high, low, close), should be included in the project specs as well.

In the Volumizer example, the length of the averages and the number of bars used in the range calculation can be adjusted by the user. This way, traders can experiment with different settings without the need to reprogram the entire indicator.

We have written the Volumizer using TradeStation EasyLanguage (see “Volumizer indicator code,” next page). The concept, however, easily could be applied to other charting platforms that allow the programming of custom indicators. “Charting volume” (below) shows the completed indicator:

The blue line is the average price

The red line (on the main chart) is relative average volume

The areas highlighted in blue indicate that average price is above relative average volume

The areas highlighted in red show that relative average volume is above average price