ObjProp

An enumeration that defines the properties that can be accessed for chart objects.

Values

Value
Description

OBJPROP_NAME

Object name

OBJPROP_TIME1

Time coordinate of the first point

OBJPROP_PRICE1

Price coordinate of the first point

OBJPROP_TIME2

Time coordinate of the second point

OBJPROP_PRICE2

Price coordinate of the second point

OBJPROP_TIME3

Time coordinate of the third point

OBJPROP_PRICE3

Price coordinate of the third point

OBJPROP_COLOR

Object color

OBJPROP_FILLCOLOR

Fill color for filled objects

OBJPROP_STYLE

Line style (see TPenStyle)

OBJPROP_WIDTH

Line width in pixels

OBJPROP_OPACITY

Object opacity (0-255)

OBJPROP_FILLINSIDE

Fill object interior

BORDER

Draw border around object

OBJPROP_BACK

Draw object behind price bars

OBJPROP_SCREENCOORDS

Use screen coordinates instead of price/time

OBJPROP_XDISTANCE

Horizontal offset in pixels

OBJPROP_YDISTANCE

Vertical offset in pixels

OBJPROP_XSIZE

Width in pixels

OBJPROP_YSIZE

Height in pixels

OBJPROP_ANGLE

Text rotation angle in degrees

OBJPROP_EXTEND_RIGHT

Extend object to the right

OBJPROP_MIDDLE_LINE

Draw middle line (TObjectType.RECTANGLE)

OBJPROP_TEXT

Text content for text objects

OBJPROP_FONTNAME

Font name for text objects

OBJPROP_FONTSIZE

Font size for text objects

OBJPROP_TEXT_PARAMS

Text parameters (font style)

OBJPROP_ANCHOR_POINT

Anchor point for text objects (see AnchorPoint)

OBJPROP_FIBOLEVELS

Number of levels for Fibonacci tools

OBJPROP_FIBOLEVELN

Fibonacci level number

OBJPROP_LEVELVALUE

Level value for Fibonacci and Gann Box

OBJPROP_LEVELCOLOR

Level color for Fibonacci tools

OBJPROP_LEVELSTYLE

Level style for Fibonacci tools

OBJPROP_LEVELWIDTH

Level width for Fibonacci tools

OBJPROP_OPACITY

Object opacity (0-255)

OBJPROP_ANGLE

Text rotation angle in degrees

Example Usage

Getting Object Properties

const time1 = this.api.GetObjectProperty("MyText", ObjProp.OBJPROP_TIME1);
const price1 = this.api.GetObjectProperty("MyText", ObjProp.OBJPROP_PRICE1);
const color = this.api.GetObjectProperty("MyText", ObjProp.OBJPROP_COLOR);
const text = this.api.GetObjectProperty("MyText", ObjProp.OBJPROP_TEXT);
const anchorPoint = this.api.GetObjectProperty(
  "MyText",
  ObjProp.OBJPROP_ANCHOR_POINT
);

Setting Basic Properties

// Set coordinates
this.api.SetObjectProperty("MyObject", ObjProp.OBJPROP_TIME1, this.api.Time(0));
this.api.SetObjectProperty(
  "MyObject",
  ObjProp.OBJPROP_PRICE1,
  this.api.Close(0)
);
this.api.SetObjectProperty(
  "MyObject",
  ObjProp.OBJPROP_TIME2,
  this.api.Time(10)
);
this.api.SetObjectProperty(
  "MyObject",
  ObjProp.OBJPROP_PRICE2,
  this.api.Close(10)
);

// Set styling
this.api.SetObjectProperty("MyObject", ObjProp.OBJPROP_COLOR, "#FF0000");
this.api.SetObjectProperty("MyObject", ObjProp.OBJPROP_WIDTH, 2);
this.api.SetObjectProperty("MyObject", ObjProp.OBJPROP_STYLE, TPenStyle.DASH);
this.api.SetObjectProperty("MyObject", ObjProp.OBJPROP_OPACITY, 200);

// Set rotation angle
this.api.SetObjectProperty("MyObject", ObjProp.OBJPROP_ANGLE, 45);

Text Properties

// Set text content and styling
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_TEXT, "Support Level");
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_FONTNAME, "Arial");
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_FONTSIZE, 12);
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_COLOR, "#0000FF");
this.api.SetObjectProperty(
  "MyLabel",
  ObjProp.OBJPROP_ANCHOR_POINT,
  AnchorPoint.CENTER
);

Rectangle Properties

// Set rectangle styling
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_COLOR, "#00FF00");
this.api.SetObjectProperty(
  "MyRectangle",
  ObjProp.OBJPROP_FILLCOLOR,
  "#00FF0020"
);
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_FILLINSIDE, true);
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_WIDTH, 1);
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_BACK, true);
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_MIDDLE_LINE, true);

// Set text for rectangle
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_TEXT, "Text");
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_FONTNAME, "Arial");
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_FONTSIZE, 12);

// Extend object to the right
this.api.SetObjectProperty("MyRectangle", ObjProp.OBJPROP_EXTEND_RIGHT, true);

Screen Coordinates Properties

// Enable screen coordinates mode
this.api.SetObjectProperty("FixedLabel", ObjProp.OBJPROP_SCREENCOORDS, true);

// Set fixed position
this.api.SetObjectProperty("FixedLabel", ObjProp.OBJPROP_XDISTANCE, 50); // 50 pixels from left
this.api.SetObjectProperty("FixedLabel", ObjProp.OBJPROP_YDISTANCE, 30); // 30 pixels from top

// Set fixed size
this.api.SetObjectProperty("FixedLabel", ObjProp.OBJPROP_XSIZE, 200); // 200 pixels wide
this.api.SetObjectProperty("FixedLabel", ObjProp.OBJPROP_YSIZE, 40); // 40 pixels tall

Last updated