RibbonsPlotter Indicator

15-minute gold futures chart with Bollinger ribbons: AMA 15 centerline and standard deviation bands
Bollinger Ribbons. Centerline is AMA, deviation is StdDev units.

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:

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.

RibbonsPlotter'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 UpperBandsRef and LowerBandsRef 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 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, RibbonsPlotter 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 Anderson Bands)
  • Average True Range - ATR (Keltner Bands)
  • Jurik Average True Range JATR (ATR using Jurik Moving Average)
  • Percentage
  • Points

Why Use the RibbonsPlotter Indicator?

The RibbonsPlotter 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 compatible 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 RibbonsPlotter2 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 the code more user-friendly and therefore less prone to inadvertent errors.

RibbonsPlotter Examples

RibbonsPlotter 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 centerline and a StdDev displacement function.

This chart shows bands at displacements of 1, 2 and 3 standard deviations.

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

15-minute gold futures chart with Bollinger ribbons: AMA 15 centerline and standard deviation bands

Anderson Ribbons use a linear regression centerline and a StdErr deviation 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.

15-minute gold futures chart with Anderson ribbons: linear regression centerline and standard error bands

This ribbon represents a Jurik Moving Average (JMA) centerline and a percentage deviation from the centerline. These ribbons maintain a relatively stable bandwidth.

The proprietary Jurik Moving Average is popular because of its 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.

15-minute gold futures chart with a Jurik moving average centerline and 0.1 percent deviation ribbons

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

15-minute gold futures chart with a Kaufman adaptive moving average centerline and standard error ribbons

Keltner Ribbons are formed by an exponential moving average (EMA) centerline and an average true range (ATR) displacement function.

15-minute gold futures chart with Keltner ribbons: EMA 20 centerline and ATR 10 bands

Specifying a centerline of Zero instead of a function of price allows this StdDev displacement function to be seen without the effects of price action. This makes it easier to see how the displacement function reacts to the volatility and trendiness of the price.

Gold futures chart with RibbonsPlotter in a subgraph: standard deviation bands plotted about the zero axis

This StdErr function is also being displayed with a centerline of zero.

This type of display allows a more useful comparison with the StdDev displacement 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.

Gold futures chart with RibbonsPlotter in a subgraph: standard error bands plotted about the zero axis

RibbonsPlotter Input Parameters

Price and Smooth: when Smooth is greater than 0, the indicator also plots a simple moving average of Price over Smooth bars ("Smooth Price").

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.

Offset is the number of bars back from which the centerline and deviation functions take their input prices. LRTgtBar is the target bar for the linear regression centerline; a negative value projects it into the future. To match the lines of the LRChan indicator, set Offset and LRTgtBar to 0.

RefID selects the function used to calculate the centerline(s). A value of 0 uses UpperBandsRef and LowerBandsRef directly as the centerlines, so a custom formula can be entered there. A value of 8 uses the fixed RefValue; with a RefValue of 0, the deviation bands are plotted about the zero axis rather than following the price.

The other functions used to calculate the centerline (AMA, EMA, LR, etc.) are numbered in the 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.

DevID selects the deviation function used to space the bands: 1 = standard deviation (Bollinger Bands), 2 = standard error, 3 = average true range (Keltner Bands), 4 = Jurik true range (ATR using the Jurik moving average), 5 = percentage of the centerline price (Percent), 6 = fixed points (Pts). StdDevLength, StdErrLength, ATRLength and JATRLength are the lengths of these functions. If StdDevLength or StdErrLength is 0, the length of the linear regression centerline (LRLength) is used instead.

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.

AddMinus is a constant added to every band value. RoundToTradable rounds the band values to a tradable price increment.

ShowPivots marks deviation pivot highs and lows with dots: a red dot above a pivot bar whose high is above the band selected by PivotMinDevBand (0 = centerline, 1 = first band, and so on), and a green dot below a pivot bar whose low is below the matching lower band. LeftStrength and RightStrength are the number of bars to the left and right that define the pivot. PivotOffsetDevMult is the distance of the dot from the bar's high or low, in multiples of the unit deviation. DotWidth is the size of the dots.

PlotWidth is the width of the ribbon lines.

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

ShowCenterLineTrendColor colors the centerline to show the direction of the trend.

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.

RefVertPct and DevVertPct are the vertical positions (in percent of the chart’s vertical range) of the centerline and deviation labels. DisplayParamOffset is the number of bars back from the last bar at which the labels are drawn, and CLTextColor and DevTextColor are the colors of the two labels.

Further, the indicator incorporates "smart positioning" of the labels. When the last price is in the upper half of the chart, the labels are drawn the specified distance above the bottom edge; when it is in the lower half, they are drawn the same distance below the top edge, so they do not overwrite the price action.

During real-time data, the indicator recalculates and replots the ribbons every CalcSeconds seconds, not on every tick.

RibbonsPlotter Indicator Input Parameters
RibbonsPlotter Input Parameters

Downloads

Initially posted version: 05/29/09

Latest Update: 11/02/13

*.ELD files are compiled for TS 9.1

Users of earlier versions of TradeStation may compile the code from the text files included in the above *.zip file.

The code may be visualized here:

Related Posts

Was this helpful? Rate it: