Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adding A Drawing Object To A Custom Indicator

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

    Adding A Drawing Object To A Custom Indicator

    Hi there,

    I've been studying a stochastic indicator that uses a 'Drawing Object' for an upper and lower critical zone within the indicator panel. I'm guessing that it is a rectangle.

    How would I go about coding something like this?

    Ideally, I'd like to have 2 separate rectangles drawn (one for an upper critical zone and one for a lower critical zone) onto my custom indicator.

    Even better, I'd like to code it so that it automatically attaches to my indicator panel when loading the indicator.

    Please let me know if you have any ideas on how I could go about this.

    Any help would be much appreciated
    Last edited by RoswellTrader; 09-06-2023, 06:17 AM.

    #2
    Hello RoswellTrader,

    The image you provided appears to just be a couple of plots and some lines. If a drawing object was used that would be the horizontal lines, the wavy lines are plots.

    To make something like that you would have to add it to the indicator that you wanted to draw the data, that wouldn't be something you could just attach to an existing indicator. You could make a custom indicator that plots data in a panel and then also draws lines or other drawing objects itself.


    Comment


      #3
      Thanks for your response, Jesse. So sorry, I should have clarified that I'm aware the wavy lines are plots. That's not the issue.

      I have my own RSI indicator with two plots.​

      Right now I'm using horizontal lines for the upper/lower critical levels.

      I'd like to hopefully replace the horizontal lines with horizontal zones.

      I'm guessing the way it's been done is with the Draw.RegionHighlightY()​ function?

      I just don't know in what section of the code I'd have to code this (OnStateChange, OnBarUpdate, etc.)

      And I'd also like these zones to be attached to my custom indicator panel by default.

      I hope I'm making sense, thanks so much for all your help.
      Last edited by RoswellTrader; 09-06-2023, 06:18 AM.

      Comment


        #4
        Hello RoswellTrader,

        If you wanted to add horizontal lines you would need to edit your indicator and then add either AddLine statements for always constant lines or you can use drawing objects if the values need to change at some point. If you wanted to shade the area between lines you could use the region RegionHighlightY tool. That would go inside OnBarUpdate.

        To draw in the indicators panel you need to use DrawOnPricePanel = false;



        Comment


          #5
          Thanks so much Jesse, the 'DrawOnPricePanel = false;' function was key to helping me figure this out.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          563 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          329 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
          547 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