Skip to main content

Locking chart objects via Javascript API

Having a function to lock chart objects that have been created from a custom indicator would be nice to have. It would help minimize accidentally selecting the chart objects as users drag through the chart view. I think creating a new ObjProp would fit best:

// lock the chart object
this.api.SetObjectProperty(name, ObjProp.OBJPROP_LOCK, true)
// unlock the chart object
this.api.SetObjectProperty(name, ObjProp.OBJPROP_LOCK, false)
2 comments

Comments2

  • Diana Zhoshko

    Team•

    Dec 11, 2025

    Hi @User ,
    We really appreciate your feedback! It has been forwarded to our developers for consideration as we explore new features.

    • Diana Zhoshko

      Team•

      Dec 11, 2025

      As the an option, our developer offers to create static objects, true at the end of each function is responsible for the toggler isStatic

      1. this.api.CreateChartObject( objName, TObjectType.TREND_LINE, 0, timeStart, priceStart, timeEnd, priceEnd, undefined, undefined, true ) this.api.SetObjectProperty(objName, ObjProp.OBJPROP_COLOR, color, true) this.api.SetObjectProperty(objName, ObjProp.OBJPROP_STYLE, style, true) this.api.SetObjectProperty(objName, ObjProp.OBJPROP_WIDTH, 2, true) this.api.SetObjectProperty(objName, ObjProp.OBJPROP_TEXT, text, true) this.api.SetObjectProperty(objName, ObjProp.OBJPROP_FONTSIZE, fontSize, true)