sineLine

The Sine Line tool plots a curved wave between two anchors, following a sinusoidal path. Traders use it to visualize cyclical market movements, forecasting swings where highs and lows might occur along a repeating rhythm.

Syntax

sineLine(originPoint, targetPoint, styles?)

Parameters

originPoint (PricedData) · First anchor (time & price), starting the sine curve. targetPoint (PricedData) · Second anchor (time & price), defining the wavelength and amplitude. styles (SineLineStyleOverrides) · Visual customization:

  • fillBackground (boolean) · Fill the area under the sine wave.

  • transparency (number) · Adjust transparency of fill (0–100).

  • showLabels (boolean) · Display labels along the curve.

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

  • background (RGBAColor | BaseColors) · Fill color under the sine curve.

Return Value

(string) · The drawing ID of the created Sine Line.

Example

Every 90 candles, draw a sine line connecting two pivots to show a repeating cycle wave.

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

onTick = () => {
  if (index % 90 === 0) { // draw every 90 bars
    // 1) Define two anchors
    const O = newPoint(time(120), closeC(120)); // sine start
    const T = newPoint(time(60),  closeC(60));  // defines curve length

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

    // 3) Draw sine line
    sineLine(O, T, style);
  }
};

Tips

  • Place anchors far enough apart to generate a clear, smooth wave.

  • Useful for visualizing market rhythm when combined with time cycle tools.

  • Try overlaying multiple sine lines of different lengths to simulate multi-cycle behavior.

Warning

  • Anchors that are too close will produce a very steep, unreadable curve.

Good Practice

  • Use distinct colors for sine lines so you can layer multiple without confusion.

  • Keep background transparency high so the wave doesn’t obscure candles.

Last updated