addLineTool()

ICE Data Services -

addLineTool()

 

addLineTool(LineTool.MOB, x, y, name);

addLineTool(LineTool.ELLIPSE, x1, x2, name);

addLineTool(LineTool.HORZ, y, nThickness, Color, name);

addLineTool(LineTool.VERT, x, nThickness, Color, name);

addLineTool(LineTool.REGRESSION, x1, x2, nThickness, Color, name);

addLineTool(LineTool.ARROW, x1, y1, x2, y2, nThickness, Color, name);

addLineTool(LineTool.SEGMENT, x1, y1, x2, y2, nThickness, Color, name);

addLineTool(LineTool.RAY, x1, y1, x2, y2, nThickness, Color, name);

addLineTool(LineTool.EXTENDED, x1, y1, x2, y2, nThickness, Color, name);

addLineTool(LineTool.CIRCLE, x1, y1, x2, y2, nThickness, Color, name);

 

  • nThickness: Line thickness in pixels.
  • Color:  Valid color value.
  • name:  Unique identifier for this line tool.

 

 

This function allows you to add various line tool objects to your chart. The supported line tool types are:

 

MOB

ELLIPSE

HORZ

VERT

REGRESSION

ARROW

SEGMENT

RAY

EXTENDED

CIRCLE

 

Colors

clearLineTool()

removeLineTool()

 

Examples:

 

function preMain() {

  setPriceStudy(true);

  setStudyTitle("linetool");

}

 

function main() {

 if(getCurrentBarIndex() == 0) {

  var c = close();

  addLineTool(LineTool.HORZ, c, 2, Color.blue, "horz1");

  addLineTool(LineTool.VERT, -34, 2, Color.blue, "vert1");

  addLineTool(LineTool.ARROW, -104, c-5, -69, c-4, 2, Color.blue, "arrow1");

 addLineTool(LineTool.SEGMENT, -104, c-4, -69, c-3, 2, Color.blue, "segment1");

  addLineTool(LineTool.RAY, -104, c-3, -69, c-2, 2, Color.blue, "ray");

  addLineTool(LineTool.EXTENDED, -104, c-2, -69, c-1, 2, Color.blue, "extended");

 addLineTool(LineTool.REGRESSION, -104, -69, 1, Color.blue, "reg1");

 addLineTool(LineTool.CIRCLE, -50, c, -34, c, 1, Color.blue, "circle1");

 }

}