Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Background color of individual panels

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

    Background color of individual panels

    Is there an easy way to change the background color of an entire panel without affecting the rest of the chart? BackColorSeries looks like an option, except you have to go bar by bar anytime a change is needed, and in a chart with multiple series you might have spaces without bars (and therefore without back colors to change). I suppose you could also draw a region, except to some degree it seems like you need to fake out the DrawRegion method by maintaining one data series where every element is 0 and another data series where every element is "infinity."

    #2
    Hello,

    Unfortunately bar by bar would be the only way I can think of to do change the background color using BackColorSeries.

    Let me know if I can be of further assistance.

    Comment


      #3
      But like I said, I think there's the possibility of gaps in multi-series charts, because there can be stretches of time with no bars in a panel if there are bars in other panels during that time. No way to color that background with BackColorSeries, right? I guess faking out DrawRegion is the path (which still seems pretty messy, frankly).

      As a suggestion, I think you should expose the panel background colors and then have a simple hierarchy: panel back color supersedes chart back color, bar back color supersedes panel back color.

      Comment


        #4
        Hello,

        When you set a color using

        BackColorAll = Color.PaleGoldenrod;

        the last color remains even if there is a space area where the main data series is not plotting.

        Comment


          #5
          I want to change the back color of individual panels. Using BackColorAll would defeat that. So, how do I get the entire background of exactly one panel to change, including regions where there are no bars?

          Comment


            #6
            Hello,

            Understood.

            Unfortunately this cannot be done with one script. As each script can only control the panel the script resides on with BackColor. You would need to add a script to each panel to color them individually.

            Let me know if I can be of further assistance.

            Comment


              #7
              I understand that. You still haven't addressed the issue of coloring ONE panel using ONE indicator, without getting any gaps.

              C'mon, Brett, it's a simple question. I write an an indicator that runs in the same panel as a data series. I want to conditionally change the back color of that panel (meaning the panel in which the indicator runs) and that panel ONLY. But there are regions in that one panel (where the indicator is running) where there are no data bars. So, how do I change the back color of the ENTIRE panel?

              Comment


                #8
                Hello,

                Sounds like you just want to set the color of the individual panel not on a OnBarUpdate basis if the bars are not even displaying in the panel. This is unfortunately not supported and requires overriding the Plot method. I was stuck thinking about multi panels with multiple indicators for some reason.

                Let me know if I can be of further assistance.
                Last edited by NinjaTrader_Brett; 09-17-2010, 02:47 PM.

                Comment


                  #9
                  I didn't say the bars weren't displaying. I said there could be some regions where bars weren't displaying. Suppose panel 1 is an RTH chart of ES and panel 2 is an ETH chart of NQ. Panel 1 will have data during the day, then no data overnight, then bars will appear again. During OnBarUpdate() my indicator – running in panel 1 – says, "Aha, different back color needed!" How do I change the back color of all of panel 1? That means both the day periods when bar data exist and the night periods when there are bars in panel 2 but not panel 1?

                  See the picture below. Suppose that's real time, and during that 11:30 bar – the last visible bar – some condition is met and I want to have a different background color in panel 1 (meaning all of panel 1). So I write an indicator, add it to the chart, associate it with ES and specify that the indicator should also run in panel 1. Now, what should my indicator do to change the back color of all of panel 1?

                  Click image for larger version

Name:	ES 12-10 (5 Min) _ NQ 12-10 (5 Min)  9_17_2010.jpg
Views:	1
Size:	58.2 KB
ID:	858409

                  Comment


                    #10
                    That is exactly what Brett is referring to. Indicators can only interact on areas where there are bars. No bars = can't do anything from OnBarUpdate() because nothing is updating = no BackColor painting can be done.

                    Only way to achieve what you want is through overriding the Plot() method and using your own custom draw logic. Unfortunately this is outside the scope of what we support.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      In my example I said during the 11:30 bar. In other words, at a time when there are bars in panel 1.

                      Suppose data are coming in, bars are updating and an indicator is running. Suppose we're in OnBarUpdate(), which in real time means for the current bar. Suppose some condition is met, and in response the back color of the entire panel is to change. How can this be done?

                      Use BackColorSeries? Doesn't look like that will work in regions where there are no bars.

                      Draw a rectangle? Maybe, but I know there was an issue where rectangles didn't display properly when the anchors were far apart.

                      Draw a region? This seems possible, but will the region draw in areas where there are no bars?

                      Or is overriding Plot() really the only way?

                      Comment


                        #12
                        You can only change the area which contains bars if you are using anything to do with BackColor. Using something like draw region or draw rectangle can draw in places without bars only if sandwich it with anchor points on both sides. Even then, using such means you will have a huge draw object on your chart which would not necessarily be a "universal" painting because you have to determine a start and end point along with a start y-value and end y-value. If that is acceptable to you, then yes, you can use that approach, otherwise Plot() method is the way to proceed.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          A rectangle makes the most sense since a panel is, well, a rectangle. But I know there had been an issue where the middle of a rectangle might disappear when a chart was scrolled, if the anchors were very far apart. Do you know if that's been resolved?

                          Comment


                            #14
                            That is the case. You need to have your anchor points around. Ultimately trying to use draw objects to achieve this is not a clean solution. Plot() method is the only clean solution I can recommend. For an example you could throw on the preinstalled indicator of CustomPlotSample onto your chart to see a similar example that just blankets the whole panel with a single background color. You can do the same while still having the bar show up. Unfortunately I do not have much more guidance I can provide above that.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              I added CustomPlotSample to a chart just to see it in action, and when it ran it certainly blanketed the panel with color! Unfortunately the blanket gets thrown over the price bars, which are then only too happy to disappear. Can you divulge the secret for getting the rectangle drawn by CustomPlotSample to the bottom of the Z-Order so nothing in the panel gets obliterated?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Carolscogginsi, Yesterday, 10:45 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post Carolscogginsi  
                              Started by RaddiFX, Yesterday, 10:15 AM
                              2 responses
                              15 views
                              0 likes
                              Last Post RaddiFX
                              by RaddiFX
                               
                              Started by patrickmlee007, Yesterday, 09:33 AM
                              2 responses
                              18 views
                              0 likes
                              Last Post patrickmlee007  
                              Started by magnatauren, 08-15-2020, 02:12 PM
                              5 responses
                              208 views
                              0 likes
                              Last Post RaddiFX
                              by RaddiFX
                               
                              Started by rene69851, 05-02-2024, 03:25 PM
                              1 response
                              23 views
                              0 likes
                              Last Post rene69851  
                              Working...
                              X