RibbonsPlotter Indicator

by | Apr 2, 2018 | Indicators

RibbonsPlotter is a superindicator that plots a wide variety of ribbon or band functions on a chart from within a single indicator, similar to the chart below:

Bollinger Band Ribbons superimposed over Gold Futures

Fig. 1. Bollinger Ribbons.  Centerline is AMA, deviation is StdDev units.

This Bollinger Band (Ribbon), for example, is one type of well-known indicator where the centerline is defined to be a simple moving average and the vertical displacement used to calculate the bands above and below this moving average is some multiple of the standard deviation.

RibbonPlotter’s flexibility arises from the fact that the user can specify the centerline function independently from the displacement function used in creating the band. It also allows many bands rather than a single band to be plotted above and below the price action, hence the name “ribbon” plotter.

The centerline, or reference, is specified by the user by an input parameter RefID, and may be any of the following functions:

  • Use UpperBandRef and LowerBandRef as centerlines for deviations ribbons (allows custom formulas to be specified).
  • Simple Arithmetic Moving Average (AMA)
  • Exponential Moving Average (EMA)
  • Linear Regression Line (LR)
  • Kaufman Adaptive Moving Average (KAMA)
  • Tillson T3 Triple Exponential Moving Average (T3)
  • Jurik Moving Average (JMA)
  • Volume Weighted Average Price (VWAP)
  • Fixed value (zero, for example, will plot the deviation bands about the zero axis, without any vertical price action)
The Jurik Moving Average function requires the user purchase this Tradestation add-on from Jurik Research. The call to this function is commented out as most users will not be licensed to use this function. Those that are licensed may uncomment out the appropriate section of code in local method RibbonsCalc to implement this feature.

The fixed value centerline allows the user to look at the deviation component of the bands without the vertical movement induced by the price action. With a fixed value of zero, RibbonPlotter will plot the deviation ribbons around the zero axis, and may be placed in a sub-graph below the main chart symbol.

The user may specify the deviation function used to produce the ribbons independently from the centerline (reference) function by specifying an input parameter, DevID. The deviation function may be any of the following:

  • Standard Deviation (Bollinger Bands)
  • Standard Error (Jon Andersen Bands)
  • Average True Range – ATR (Keltner Bands)
  • Jurik Average True Range JATR (ATR using Jurik Moving Average)
  • Percentage
  • Points

Why Use the RobbonPlotter Indicator?

The RibbonPlotter indicator consolidates the ability to plot a large variety of ribbons into a single indicator. This indicator then can replace several other indicators and provides a consistent user interface for this collection of functions. It utilizes features of OOEL such as local methods for increased efficiency.

RibbonsPlotter2 is an older version of RibbonsPlotter that uses function RibbonsCalc2 to calculate all values for the ribbons, instead of a local method RibbonsCalc. This makes RibbonsPlotter2 compatable with Tradestation versions prior to 9.0.

The function RibbonsCalc2 may also be called from a strategy. Since the same function generates values for both the strategy and the RibbonPlotter2 indicator, the user can be assured that the values will be the same, provided the input parameters match.

The single multi-purpose ribbon function RibbonsCalc2 has many benefits to the developer of automated trading strategies:

  • The optimizer can test many different types of trading strategies without altering the basic strategy coding since the optimization process can, for example, switch between Bollinger Band, Keltner Band and Percentage Band testing without requiring a manual manipulation or duplication of the strategy code.
  • Code revisions and updates can be done in a single location, without the necessity of duplicating the changes throughout several different indicators or strategies.
  • A consistent user interface across many separate functions makes makes the code more user-friendly and therefore less prone to inadvertent errors.

RibbonPlotter Examples

RibbonPlotter is capable of producing a wide variety of ribbon plots. Some of the examples shown below represent the most common and well-known ribbon or band functions. One or two less common variations are also shown.

Bollinger Ribbons are formed from an arithmetic moving average center-line and a StdDev displacement function.

This chart shows bands at displace-ments of 1, 2 and 3 standard deviations.

The bands characteristically widen when price is trending and narrow during consolidation.

Bollinger Ribbons displayed on Gold Futures Chart
Anderson Ribbons use a linear regression centerline and a StdErrdeviation function.

Each band represents one standard error increment away from the centerline.

The linear regression centerline hugs the price more closely than a moving average, and standard error bands do not expand significantly when the price action is trending, unlike with Bollinger Bands. Instead, narrow bands indicate the price is trending consistently close to the regression line. Wide bands suggest increasing volatility of price away from the regression line and are typically seen during a break in a trend.

Jon Anderson Ribbons - linear regression centerline with standard error deviations from centerline
This ribbon represents a Jurik Moving Average (JMA) centerline and a percentage deviation from the centerline.

The propriety Jurik Moving Average is popular because of it’s smoothness and low lag. It must be purchased as an add-on to Tradestation.

The Tillson T3 Moving Average is similar and has almost the smoothness and low lag of the Jurik, and is available to Tradestation users as a built-in function.

Juric Moving Average Centerline with Percentage Deviations from centerline shown

This Kaufman Adaptive Moving Average centerline shows relative horizontal tability centerline during consolidation. In combination with StdErr deviation bands makes an interesting basis for a Reversion to the Mean type of trading system.

Ribbons with Kaufman Adaptive Moving Average centerline and standard error deviationsd
Keltner Ribbons are formed by an exponential moving average (EMA) centerline and a average true range (ATR) displacement function.
Keltner Ribbons - EMA centerline with ATR displacement lines shown
This is a Jurik Moving Average centerline with percentage deviation ribbons.

These ribbons maintain a relative stable bandwidth.

Jurik Moving Average centerline with percentage deviation ribbons shown
Specifying a centerline of Zero instead of a function of price allows this StdDev displacement function to be seen without the affects of price action. This makes it easier to see how the displacement function reacts to the volatility and trendiness of the price.
Ribbons with centerline = zero and standard deviation displacements shown
This StdErr function is also being displayed with a centerline of zero.

This type of display allows a more useful comparison with  the StdDevdisplacement function above.

It is easier to see the unique characteristics and differences between deviation functions when they are displayed about a fixed reference rather than following the price action.

Zero axis centerline with Standard Error Deviations shownn

RibbonPlotter Input Parameters

UpperBandsRef and LowerBandsRef are the input prices used to calculate the upper and lower centerlines. Usually these are the same and therefore produce a single centerline. However, the user can define separate centerlines for the upper bands and the lower bands, hence the two input parameters.

RefID selects the function to use to calculate the centerline(s). A value of 0 indicates the deviation function will be plotted centered about the zero axis, rather than following the price.

The other functions used to calculate the centerline (AMA, EMA, LR, etc.) are numbers in order of their length parameters following RefID. To select an exponential moving average centerline, for example, the user would enter 2 since EMALength appears in the second position following RefID. The user would specify a RefID of 3, 4 or 5 to choose a centerline consisting of a linear regression line, a Kaufman moving average or a Tillson T3 moving average, respectively, as this is the order that their corresponding length parameters appear in the input parameter list.

NBands is the number of bands (ribbons) above and below to be plotted. StartMult is the multiplier to be used for the first band. The subsequent ribbons up to a total of NBands are drawn by adding Increment to the starting multiplier for the first band.

ShowCenterLine alllows the user to either display or not display the centerline for the ribbons.

DisplayParameters determines if the parameter values for the centerline and deviation function will be displayed on the graph in text, as was done in the samples shown. These text labels were drawn by the indicator instead of being added manually after the chart was produced.

CLVertPct, DevVertPct, CLHorizPct and DevHorizPct are the vertical and horizontal displacements (in percent of vertical or horizontal chart range) used to position the location of the text labels on the chart.

Further, the indicator encorporates “smart positioning” of the labels. If the price action is near the bottom edge of the chart and the user has specified that the label is to be drawn near the bottom of the chart, the program will automatically flip the label to the top of the chart to avoid overwriting the price action. The vertical displacement from the bottom edge of the chart specified by the user will be preserved, but instead this will become the vertical displacement from the top edge of the chart.

Typical Input Parameters screen capture


Initial posted version:  05/29/09

Latest Update:  11/02/13

*.ELD files are compiled for TS 9.1

All ELD and code text files packaged here:


Users of earlier versions fo Tradestation may compile the code
from the etext files included in the above *.zip file.

The code may be visualized here:

Indicator RibbonsPlotter

Function JMATrueRange