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

How to Draw Text Only in a Pane

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

    How to Draw Text Only in a Pane

    Hi,

    I'm trying to get text to draw in an indicator pane. Ultimately, I want just the text, but it looks like the DrawText method needs something to reference the Y value. So, I created a dummy indicator, which plots a histogram with a fixed value of 4. Then, in the DrawText parameter, I set y = 2, thinking that would allow the text to draw in the middle of the histo.

    No luck. I do have indicator set to Overlay = false.

    #2
    Hello coolmoss,

    You can have the draw objects be painted on the same panel as the indicator instead of the price panel by using the DrawOnPricePanel setting and change it to false.

    http://www.ninjatrader.com/support/h...pricepanel.htm

    Let us know if we can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Thanks, JC.

      Works like a charm. However, now I'm a bit confused because I had thought that Overlay = false does the same thing. I hadn't even realized DrawOnPricePanel existed. Can you briefly explain how these two are different? Do I need both or should I just use DrawOnPricePanel in onInitialize?

      Comment


        #4
        Hello coolmoss,

        Plot(s) and drawing object(s) are going to be separate on how they are drawn so different settings are required for each of them. Overlay is going to be for the plot(s) settings so if you want to have the plot(s) to be drawn on the same panel as the input data series then you would want to set this as true, otherwise by default it is going to draw on a different panel (set to false). DrawOnPricePanel is going to be for the drawing object(s) so by default it is going to draw the objects on the input data series.

        You would only need to set the DrawOnPricePanel to false as Overlay by default is set to false.

        Let us know if we can be of further assistance.
        JCNinjaTrader Customer Service

        Comment


          #5
          Thank you very much for such a complete answer. The detail is much appreciated!

          Comment


            #6
            Hello coolmoss,

            You are quite welcome and as aways, let us know if we can be of further assistance.
            JCNinjaTrader Customer Service

            Comment


              #7
              Is there any way that I can draw 1 plot in the price panel and 1 plot in the indicator panel?

              Comment


                #8
                Hello teoteovn,

                That would not be something that we can support at this time.
                JCNinjaTrader Customer Service

                Comment


                  #9
                  In my first post I mentioned using a "dummy" indicator to give the plotted text a Y-axis reference. I'd like to avoid using this dummy indicator and found that if I set the right scale properties appropriately it works just fine without dummy indicator.

                  So, is there a way to override the defaults and force my desired fixed range for the right scale in the indicator code?
                  Last edited by coolmoss; 10-10-2012, 06:51 PM.

                  Comment


                    #10
                    Originally posted by coolmoss View Post
                    In my first post I mentioned using a "dummy" indicator to give the plotted text a Y-axis reference. I'd like to avoid using this dummy indicator and found that if I set the right scale properties appropriately it works just fine without dummy indicator.

                    So, is there a way to override the defaults and force my desired fixed range for the right scale in the indicator code?
                    Does anything in ChartControl help?

                    What is the big deal anyways with having a plot?

                    Does this post help?

                    Comment


                      #11
                      Originally posted by coolmoss View Post
                      In my first post I mentioned using a "dummy" indicator to give the plotted text a Y-axis reference. I'd like to avoid using this dummy indicator and found that if I set the right scale properties appropriately it works just fine without dummy indicator.

                      So, is there a way to override the defaults and force my desired fixed range for the right scale in the indicator code?

                      I used some of the ideas in ChartScale to give me a fixed distance, and used DrawText to write the text for my BatteryLevel indicator I wrote.



                      Yes - I have a plot, but I could hide that...no?...
                      Attached Files

                      Comment


                        #12
                        Hey Sledge, thanks!

                        Can you tell me what "chart control" is? That's new to me.

                        I it's not that I couldn't hide the plot, it's that even though I tried adding a plot my text objects still didn't scale correctly. That's why I'm looking to force the right-scale to fixed via code.

                        Comment


                          #13
                          Originally posted by coolmoss View Post
                          Hey Sledge, thanks!

                          Can you tell me what "chart control" is? That's new to me.

                          I it's not that I couldn't hide the plot, it's that even though I tried adding a plot my text objects still didn't scale correctly. That's why I'm looking to force the right-scale to fixed via code.
                          Can you post a picture of what you are trying to do or some sample code?

                          What didn't scale properly?

                          ChartControl is what NT uses from MS .net from my understanding. You can do some extra things in there that NT doesn't support.

                          Comment


                            #14
                            I figured out the there is a bool scaling parameter right in the DrawText() method which solved the issue just fine. Nice when simple works!

                            Sledge, can you point me to any thread or reference on chart control? I did a quick search but couldn't find anything like what you're referring to. It sounds intriguing, even if not supported. I don't mind experimenting.

                            Thanks again for your help on this.

                            Comment


                              #15
                              Hello coolmoss,

                              You can view the following thread where member of the forum have posted some snippet of code using the ChartControl.

                              http://www.ninjatrader.com/support/f...ad.php?t=23979
                              JCNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jpapa, Today, 07:22 AM
                              1 response
                              5 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by kevinenergy, 02-17-2023, 12:42 PM
                              116 responses
                              2,758 views
                              1 like
                              Last Post kevinenergy  
                              Started by franatas, 12-04-2023, 03:43 AM
                              7 responses
                              106 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Jltarrau, Today, 05:57 AM
                              3 responses
                              9 views
                              0 likes
                              Last Post Jltarrau  
                              Started by f.saeidi, Today, 05:56 AM
                              2 responses
                              9 views
                              0 likes
                              Last Post NinjaTrader_Erick  
                              Working...
                              X