Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I draw on a chart when my indicator is in a separate panel?

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

    Can I draw on a chart when my indicator is in a separate panel?

    Hi,

    my indicator is below the chart and I'd like to draw some text on the bottom center of the chart.
    When I use DrawText(this, ...) the text is of course drawn on my indicator panel.
    Is there a way to supply the chart panel instead of "this"?

    And do I need to use SharpDX onRender if I want to draw on the bottom center?
    Its not a supported location For DrawTextFexed, and I don't know where to get x/y coordinates for DrawText (assuming I can indeed use that to draw on the chart instead of my own panel).

    #2
    Hello wjadevries, thanks for your post.

    We have the DrawOnPricePanel property for this purpose. Setting this to true in State.SetDefaults will make all the drawing methods draw to the price panel rather than the indicator panel.

    Please let me know if you have any questions on this material.

    Comment


      #3
      I know, but I can't set DrawOnPricePanel to true, because I'm also drawing text on my indicator panel.
      So I need to be able to draw text on both the price panel and my indicator panel.
      Forgot to mention that; sorry.

      Comment


        #4
        Hello, thanks for your reply.

        You will not be able to draw to the sub-panel unless you use custom rendering. So to get this to work, you need to set DrawOnPricePanel to true then draw anything in the price panel using SharpDX in the OnRender method. We have an overview of using OnRender here:

        https://ninjatrader.com/support/help..._rendering.htm

        It can take some time to learn this if you are just starting out, so please let me know if any questions come up.

        Comment


          #5
          Originally posted by wjadevries View Post
          I know, but I can't set DrawOnPricePanel to true, because I'm also drawing text on my indicator panel.
          So I need to be able to draw text on both the price panel and my indicator panel.
          Forgot to mention that; sorry.
          Hello wjadevries,
          You can set DrawOnPricePanel property for each Draw.Text you are using, so then you can draw on price panel while your indicator is on separate panel. Also if you need you can draw on both panels as required, just set the property for each text command.
          example:
          Draw.Text(this, "pp", "test", 0, Low[0] - 5);
          DrawOnPricePanel = false;
          Draw.Text(this, "ip", "test", 0, 0);
          DrawOnPricePanel = true;
          pp should draw on price panel & ip will draw on indicator panel. I am assuming you've set default DrawOnPricePanel = true; so you're basically resetting this property after each text command.
          Hope it helps!
          Last edited by s.kinra; 10-20-2020, 10:39 PM.

          Comment


            #6
            TestText.zip
            Here you get the sample code.

            Comment


              #7
              Thanks, that's what I need!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              651 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              370 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              109 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              574 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              577 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X