
The chart above 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).
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:

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 than 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:

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:

Steps to Erase a Plot (TS versions prior to 9.0)
- Plot the desired function (Typical Price, in this example).
- 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).
- 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.
Steps to Erase a Plot (TS versions 9.0 and later)
The reserved word transparent was introduced to EasyLanguage in version 9.0, providing a simpler method to erase a plot:
Plot1(TypicalPrice, "Price", Cyan, default, 1);
Plot1[PriceLength]( Plot1, "Price", transparent);Note that the second line over-writes PriceLength bars back from the current bar, effectively making invisible whatever was plotted by the first statement.
The final code may be visualized by clicking the Indicator: PlotErase link below.
Downloads
Initially posted version: 01/02/08
Latest Update: 01/31/10
*.ELD files are compiled for TS 8.7
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:
