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

BackBrush Behavior Change With Custom OnRender

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

    BackBrush Behavior Change With Custom OnRender

    Did the behavior of BackBrushes change when an indicator has custom OnRender change?


    I believe the background coloring was skipped previously when the custom OnRender was used. My indicators did background coloring on their own, and now are broken.


    It would seem that the change in the case of BackBrushesAll is welcome, as a custom render can not address all panels, but I am not so sure about BackBrushes. Is there an option that can be set to disable the Ninja background coloring based on BackBrushes?

    #2
    Hello aslane,

    May I confirm you are calling base.OnRender(chartControl, chartScale); to allow OnRender() to rendor for plots and other things that use rendering?

    Below is a link to the help guide.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      No, I do not call base.OnRender() because I am doing all of the plotting. For example, I have studies that plot as OHLC bars etc. That's actually why I was surprised to see the background get colored for me.

      Comment


        #4
        Hello aslane,

        By not calling the base.OnRender() this blocks other scripts and behind the scenes objects from being rendered.

        What happened when you tested adding this? Did this not resolve the behavior?

        To confirm you are not able to set BackBrushAll when base.OnRender() is being called in OnRender()?

        I am not able to reproduce this behavior.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I do not think you understand, I'll try to be more clear (sorry if BackBrushesAll comment confused you).

          I have an indicator that sets values etc as usual, this includes setting BackBrushes.

          The OnRender then renders the values, in this case as OHLC bars (but that does not really matter). As part of the my render process, the background is optionally colored before the values are rendered.

          I would not expect the background to be rendered by NinjaTrader, but it is. This did not use to happen (that's why my render took care of).

          As an aside, an indicator should have no requirement to call base.OnRender, and this should have nothing to do with other behind the scenes objects as you say. That should be called from the chart OnRender, not the indicator. Otherwise Ninja would be fundamentally broken.

          Comment


            #6
            Attached is simple example showing issue. The background is rendered, but should not be.
            Attached Files

            Comment


              #7
              Hello aslane,

              With the script you have provided you have failed to add base.OnRender() as directed and the behavior is expected.

              Attached is an example with the code added in that I have suggested that works correctly.
              Attached Files
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Ah, please re-read. I am NOT trying to use BackBrushesAll.

                The problem is BackBrushes IS being rendered, it SHOULD NOT BE if base.OnRender is not called. My example shows this issue perfectly.

                Comment


                  #9
                  Hello aslane,

                  I did read this incorrectly.

                  When you mention "It would seem that the change in the case of BackBrushesAll is welcome", you are not saying that BackBrushAll has been changed and you are only inquiring about BackBrushes, is this correct?

                  I've modified the script to use BackBrushes, which is still functioning as expected for the individual panel it is added to.
                  Attached Files
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Yes on same page now.

                    Your example is wrong though. If you remove the call to base.OnRender (like in my example), you will still see the back colors. It should only render those back colors if you do call base.OnRender. See the difference? In my example, the expected behavior is a blank panel because the OnRender was empty, but its not.

                    Comment


                      #11
                      Hello aslane,

                      The expected behavior would be that the background color would become the color set with BackBrushes[0]. This is what this is used for.

                      We have been trained that you must call base.OnRender() for other things like plots to be rendered properly by our development.

                      We have been trained that not calling base.OnRender() causes issues everywhere with other things not being rendered properly.

                      Are you wanting a bug report submitted that BackBrushes is setting the background color when set as shown in my example?

                      Are trying to report that the warning and example we've put in the help guide is insufficient?

                      You are wanting BackBrushes to not render anything when they are set, is this correct?
                      Last edited by NinjaTrader_ChelseaB; 05-28-2018, 09:14 AM.
                      Chelsea B.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_ChelseaB View Post
                        We have been trained that you must call base.OnRender() for other things like plots to be rendered properly by our development.
                        Correct, but the opposite is also true. If you do not call base.OnRender, then they should NOT be rendered.

                        Originally, I was asking a question to see if this behavior had changed, but now with my simple example, I see that it is clearly a bug that should be fixed.

                        My simple example, should yield a blank panel. It does not. Clearly a bug. Please report this bug. The BackBrushes should NOT be rendered within an indicator unless base.OnRender is called.

                        Note: There is no requirement to call base.OnRender. In fact, the doc shows examples with it not called.

                        Comment


                          #13
                          Hello,

                          The page on OnRender() in the help guide does in fact show that base.OnRender() should always be called if you are overriding the OnRender() method and only if you are overriding the OnRender() method.

                          This is only mentioned on this page and is for sure mentioned on this page.
                          Below is another link to the help guide. Please see the section "Calling the base.OnRender() method to ensure Plots are rendered along with custom render logic".


                          So you would like a bug report that things like BackBrushes are still rending when base.OnRender() is not called and OnRender() is overridden?

                          Is there something in the help guide where it is mentioned to expect this? (We can change our language in the help guide if this is the case as it is only sometimes necessary)

                          This affects some items but will not always affect everything. Sometimes it may or may not prevent a plot from another indicator from plotting. However, base.OnRender() should always be called when overriding the OnRender() method.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Originally posted by NinjaTrader_ChelseaB View Post
                            However, base.OnRender() should always be called when overriding the OnRender() method.
                            WRONG! If this were true, then many of your built in indicators are flawed (i.e. @Pivots, @PriceLine, @VolumeProfile etc.)

                            Also, the doc does NOT say anywhere that you should call base.OnRender, except in the case where you are using built in Plots and expect them to plot correctly. Not to mention 2 of the 3 examples on the page do not call base.OnRender.

                            Comment


                              #15
                              Hello aslane,

                              It really depends on the order that things are being rendered in.

                              I will forward a note that we need to update nt scripts that are not dependent on the base.OnRender() but override the OnRender() method to have this added for consistency.

                              Where the help guide is showing base.OnRender() its telling why this needs to be added. However, its on the OnRender() page because everything on this page should be considered when overriding OnRender().

                              That said, an object rendering when the base.OnRender() is not be called is not a bug. Its just sometimes necessary and really should always be used. We'll get our scripts updated to just make this less confusing.

                              The other examples will not necessarily include this other things like using OnRenderTargetChanged. Most example code you find in the help guide are incomplete as samples as they are demonstrating something specific. (especially in the Addon area)

                              However, for complete samples we do try and code to the standards shown in the help guide.
                              Last edited by NinjaTrader_ChelseaB; 05-28-2018, 10:52 AM.
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by jeronymite, 04-12-2024, 04:26 PM
                              2 responses
                              28 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by Mindset, 05-06-2023, 09:03 PM
                              10 responses
                              262 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by michi08, 10-05-2018, 09:31 AM
                              5 responses
                              741 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by The_Sec, Today, 02:29 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post The_Sec
                              by The_Sec
                               
                              Started by tsantospinto, 04-12-2024, 07:04 PM
                              4 responses
                              62 views
                              0 likes
                              Last Post aligator  
                              Working...
                              X