HighTick


How To Erase A Plot

This screen shot shows the TypicalPrice indicator plotted on a daily chart. We are interested in having this indicator show on the most recent 10 bars of a chart (cyan), and erasing the indicator beyond the 10th bar (yellow).

Chart showing Erased Plot

Fig. 1. Chart showing unwanted portion of indicator plot in yellow

To erase the portion of the indicator shown in yellow, we can plot over the original plot with a second plot command, replacing the color with the background color (black) as follows:

 

Plot1(TypicalPrice, "Price", cyan, default, 1);

Plot1[PriceLength](TypicalPrice, "Price", black, default, 1);

 

 

This produces the chart shown below:

Fig. 2. Unwanted portion of plot overplotted in black to hide original plot

This chart contains an undesirable result in that the overplotted indicator leaves a trail of black lines passing through the candlestick bodies and tails. To improve the appearance of an erased indicator, the indicator can be shifted from its original value to a value that is beyond the range of the candlestick bodies and tails. However, it is preferable not to shift the original indicator more than necessary to prevent the chart from rescaling the vertical axis and shrinking or compressing the price action. It is also desirable to make the shifted plot as narrow as possible to avoid overplotting and covering over any more of the small dots comprising the chart grid that necessary.

A convenient function to use to produce the desired shift is the fast calculation version of the Lowest Low function, LowestFC:

 

Plot1(TypicalPrice, "Price", Cyan, default, 1);
Plot1[PriceLength]( LowestFC(Low, DisplaceLength), "Price", Yellow, default, 0);


Using a DisplaceLength of 15 (greater than the length of the price that we desire to display, PriceLength = 10), produces the chart below:

Fig. 3. Chart with unwanted portion of plot displayed entirely below the bar lows

And finally, we change the color of the original function that has been shifted away from the candlestick bodies and tails to match the background color of the chart (black), producing:

chart showing final version of erased indicator.  There is almost no evidence of the erased indicator remaining on the chart.

Fig. 4. Displayed unwanted portion of plot is now overplotted in black, producing final desired hidden result

This leaves a chart with minimal evidence that a indicator has been erased.

Steps To Erase a Plot
  1. Plot the desired function (Typical Price, in this example).
  2. Overplot this function with an offset of PriceLength bars, changing the color of the overplot to match the background color of the chart, and setting the width of this overplotted indicator to the narrowest width possible (width = 0).
  3. Shift the overplot away from the symbol candlestick bars so that the overplotted function line (now in the background color: black) does not cross any of the body or tails of the candlesticks. This may be accomplished with the Lowest Low function using a length somewhat greater than the length of the indicator portion to remain visible on the chart.

 

The final code may be visualized by clicking the PlotErase Indicator link below.

 

MarkSanDiego

Downloads

Initial posted version: 01/02/08

Latest Update: 01/31/10

*.ELD files are compiled for TS 8.7

All ELD and code text files packaged here:

PlotErase.zip

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:

PlotErase Indicator

 

 

Bookmark and Share