Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.


    JesseNinjaTrader Customer Service

    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;



        JesseNinjaTrader Customer Service

        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 fx.practic, 10-15-2013, 12:53 AM
          5 responses
          5,403 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by Shai Samuel, 07-02-2022, 02:46 PM
          4 responses
          94 views
          0 likes
          Last Post Bidder
          by Bidder
           
          Started by DJ888, Yesterday, 10:57 PM
          0 responses
          6 views
          0 likes
          Last Post DJ888
          by DJ888
           
          Started by MacDad, 02-25-2024, 11:48 PM
          7 responses
          158 views
          0 likes
          Last Post loganjarosz123  
          Started by Belfortbucks, Yesterday, 09:29 PM
          0 responses
          8 views
          0 likes
          Last Post Belfortbucks  
          Working...
          X