ghostFeed

The Ghost Feed tool allows you to plot a series of price points (a “ghost” price path) forward on the chart. Traders use it to test what-if scenarios or to replay alternate projections without affecting the real price data.

Syntax

ghostFeed(points, styles?)

Parameters

points (PricedData[]) · An array of time & price anchors defining the ghost path. styles (GhostFeedStyleOverrides) · Visual customization:

  • fillBackground (boolean) · Fill the area below the ghost path.

  • transparency (number) · Background transparency (0–100).

  • showLabels (boolean) · Show labels on ghost points.

  • line (LinesLevels without coeff) · Style for the ghost path (linestyle, linewidth, color).

  • background (RGBAColor | BaseColors) · Fill color below the path.

Return Value

(string) · The drawing ID of the created Ghost Feed.

Example

Every 100 candles, project a ghost path using four future anchor points.

//@version=1
init = () => {
  indicator({ onMainPanel: true, format: 'inherit' });
};

onTick = () => {
  if (index % 100 === 0) { // draw every 100 bars
    // 1) Define ghost anchors
    const points = [
      newPoint(time(90),  closeC(90)),
      newPoint(time(70),  high(70)),
      newPoint(time(50),  low(50)),
      newPoint(time(30),  closeC(30))
    ];

    // 2) Style settings
    const style = {
      fillBackground: true,
      transparency: 75,
      showLabels: true,
      line: { linestyle: 2, linewidth: 2, color: color.teal },
      background: color.rgba(0, 128, 128, 0.2)
    };

    // 3) Draw Ghost Feed
    ghostFeed(points, style);
  }
};

Tips

  • Use Ghost Feed to simulate alternate paths the market could take.

  • Handy for backtesting manually: overlay ghost projections and compare them with what actually happened.

  • Can also be used in education to demonstrate “what-if” scenarios.

Warning

  • Avoid overcrowding your chart with too many ghost feeds — it can get confusing.

Good Practice

  • Keep ghost feeds in dashed or semi-transparent styles so they’re clearly distinct from real price data.

  • Store ghost paths in arrays (points[]) so you can quickly modify or replay scenarios.

Last updated