Skip to main content

the api of drawing rectangle in Trading Session indicator

I have checked the documentation but still couldn’t find an effective way to draw background colors. Could you please let me know which API the Trading Session indicator is using?

How does this impact your experience?
3 comments

Comments3

  • Serhii S.

    Team•

    Sep 26, 2025

    Dear @Hendry! The Trading Session indicator uses the standard rectangle chart object API with a transparent fill color and disabled border.

    Here’s an example of how this is implemented:

    this.api.CreateChartObject(objectName, TObjectType.RECTANGLE, 0, sessionOpen, lowestPrice, sessionClose, highestPrice, undefined, undefined, true)

    this.api.SetObjectProperty(objectName, ObjProp.OBJPROP_FILLCOLOR, #00ff0080, true)

    this.api.SetObjectProperty(objectName, ObjProp.BORDER, false, true)

    This is the API approach the Trading Session indicator uses to draw session backgrounds with colored rectangles.

  • Serhii S.

    Team•

    Sep 26, 2025

    Hi @Hendry , thanks for your question.

    I've asked our developers about the API used for the Trading Session indicator and will get back to you once I have an answer.

  • Hendry5479

    •

    Sep 26, 2025

    like this