# SetObjectProperty

Sets a property value for a chart object.

## Syntax

```typescript
SetObjectProperty(
  name: string,
  index: number,
  value: any,
  isStatic: boolean = false
  ): boolean
```

## Parameters

| Parameter | Type    | Description                                             |
| --------- | ------- | ------------------------------------------------------- |
| name      | string  | The name of the object                                  |
| index     | number  | The property identifier                                 |
| value     | any     | The value to set                                        |
| isStatic  | boolean | Optional. Whether the object is static (default: false) |

## Return Value

Returns `boolean` - `true` if the property was set successfully, `false` otherwise.

## Description

The `SetObjectProperty` method sets a property value for a specified chart object. It can handle both numeric and string properties, and automatically converts time values from FTODate to the internal format.

## Example

```typescript
// Set object coordinates
const success1 = this.api.SetObjectProperty(
  "MyTrendLine",
  ObjProp.OBJPROP_TIME1,
  this.api.createFTODate(1641024000000)
);
const success2 = this.api.SetObjectProperty(
  "MyTrendLine",
  ObjProp.OBJPROP_PRICE1,
  1.2
);

// Set visual properties
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_COLOR, 0xff0000); // Red color
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_STYLE, 1); // Solid line
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_WIDTH, 2); // Line width

// Set text properties
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_TEXT, "New Label Text");
this.api.SetObjectProperty("MyLabel", ObjProp.OBJPROP_FONTSIZE, 12);

// Set object state
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_HIDDEN, true);

// Lock from mouse move/resize (indicator code can still use MoveObject)
this.api.SetObjectProperty("MyTrendLine", ObjProp.OBJPROP_LOCKED, true);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fto-2.gitbook.io/fto-indicators-docs/access_to_objects/set-object-property.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
