Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to draw a line using OnRender

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to draw a line using OnRender

    Hi

    I'm trying to get my head around how to use OnRender to draw a line on a chart at a given price (open price at 10am) and between a time period (e.g. 10am to 4pm) for the current session.

    I've tried studying the Sample custom render indicator and documentation online, but that seems to concentrate on drawing lines not relative to price.

    Does anyone have a simple example that could get me going, even if it just draws the line, but needs to be using OnRender.

    Thanks
    Tim

    #2
    Hello, thanks for writing in. I attached a very basic Line drawing tool that shows how you can draw a single line using the two vectors.

    Kind regards,

    -ChrisL
    Attached Files

    Comment


      #3
      Hi ChrisL

      Thanks for the reply. I was looking to use this as an Indicator rather than a drawing tool.

      This example is 400+ lines of code and I was hoping for something much simpler that I could build on within an indicator. e.g. draw a line at the open price at 10am and extend it to 4pm, ideally with a label "10am "that is visible on the chart as you scroll.

      Something similar to the Pivots indicator but even with that I was struggling to figure out which bits of the code I need.

      Anything closer to that you could help me with?

      Much appreciated.
      Tim

      Comment


        #4

        Hello, thanks for the follow-up. It would take a surprisingly large amount of code in OnRender even to draw a basic line. In the drawing tool, you would only focus on what the OnRender method is doing in that script. The most similar indicator, that still requires a large amount of code in OnRender is the ZigZag indicator, which would be the next best reference to complete a project like this.

        ​Kind regards,

        -ChrisL

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        558 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X