Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars of the indicator overlayed on the chart

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

    Bars of the indicator overlayed on the chart

    Hello!!

    When one develops an indicator, he can choose if the indicator will be overlayed on the chart (true) or not (false). It is what happens with dots, lines, triangles...
    This is FOR ME a bit complicated when it comes to BARS. Usually, the bars of the indicator are plotted on another panel. I mean here the bars as indicator and not the bars forming the chart. I have an indicator with the property: overlay = true, that means I have the bars of the indicator on the chart. The problem is that these bars go from the chart down to the bottom of the panel on which I have the chart, what was not the idea.
    Is there a tric to avoid the extension of the bars as indicator down to the bottom of the panel?

    I have attached a picture to illustrate this behaviour. I have set the colors of the indicator to red and blue. The blue color on the chart represents the indicator in a bullish trend, but it also hides the indicator itself. Also, there would not be any blue bar extending the bars of the indicator in the red color.
    Is there a property to avoid this extension?

    Best regards,
    Attached Files

    #2
    I'm not sure what you are trying to do here. Do you want to display a filled REGION? If so, check Draw.Region and draw it between the two lines. If you're trying to display a candlestick or OHLC bar consisting of the values of your indicator intrabar, you would do this with a custom OnRender().
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Many thanks Bruce for your reply.

      No I do not want to disply a filled region. Please have a look on the attached picture. It is the same indicator as in my previous post, but I have set the given ploted color to the background color, I have some bars overlayed by the indicator (mostly the red bars on this picture). My goal is to avoid that. Is there a property for that? If not, any idea how to fix it?

      Any help?

      Thanks!​
      Attached Files

      Comment


        #4
        Well, to make it look EXACTLY like that you would probably end up doing a custom OnRender(). You could also draw vertical lines instead of using plots, but that has a serious performance impact when there are a large number of bars on the chart. A custom OnRender() would give you the most flexibility, but also require the most code.
        Bruce DeVault
        QuantKey Trading Vendor Services
        NinjaTrader Ecosystem Vendor - QuantKey

        Comment


          #5
          Originally posted by Stanfillirenfro View Post
          I have some bars overlayed by the indicator (mostly the red bars on this picture). My goal is to avoid that. Is there a property for that? If not, any idea how to fix it?
          Have you tried changing the ZOrder?

          You can manually adjust the ZOrder of your indicator,
          Last edited by bltdavid; 05-05-2023, 08:07 AM.

          Comment


            #6
            Hello Stanfillirenfro,

            Thank you for your patience.

            Based on your second screenshot, the change of the plot to the background color seems to make it so the bars that extend to the bottom of the chart panel are not shown. Does this resolve your initial question?

            As for the indicator showing on top of your bars, please try out David's suggestion by changing the Z-Order so that the price bars are on top of the indicator plot. If this does not resolve your inquiry, please provide a clear description (and an example if possible) of what you are looking for vs. what you are actually experiencing so we may better understand and assist you.

            I look forward to resolving this item with you.

            Comment


              #7
              Many thanks to all of you for your help!

              I have fixed the problem partially by using ZOrder as specified by David. Many thanks again.

              Based on your second screenshot, the change of the plot to the background color seems to make it so the bars that extend to the bottom of the chart panel are not shown. Does this resolve your initial question?
              NinjaTrader_Emily the problem is solved only partially.

              But when I try to move the chart from left to right and vice versa with the cursor below the bars, it is not possible. The indicator is highlighted and the chart can not be moved. The chart can be moved from left to the right for example only when the cursor is above the chart,

              The problem is partially solved and many thanks for your advises.
              Last edited by Stanfillirenfro; 05-05-2023, 12:33 PM.

              Comment


                #8
                Originally posted by Stanfillirenfro View Post
                But when I try to move the chart from left to right and vice versa with the cursor below the bars, it is not possible. The indicator is highlighted and the chart can not be moved. The chart can be moved from left to the right for example only when the cursor is above the chart...

                This is sort of out there, but you should be able to make your plots "unclickable" so they don't intercept your mouse actions by overriding OnRender and checking IsInHitTest and if it is (in a hit test) just return without running base.OnRender(). Your mileage may vary.
                Last edited by QuantKey_Bruce; 05-05-2023, 12:58 PM.
                Bruce DeVault
                QuantKey Trading Vendor Services
                NinjaTrader Ecosystem Vendor - QuantKey

                Comment


                  #9
                  Many thanks Bruce for your reply.

                  I do not use OnRender() for this indicator, but OnBarUpdate(). I have googled quickly to see if I can have another function that replaces the condition IsInHitTest for OnBarUpdate(), but I am failing to find one.

                  Any idea?

                  Thanks!

                  Comment


                    #10
                    Stanfillirenfro Add this to your indicator and then try to click on your plots. Let us know what happens.

                    Code:
                    protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
                    {
                            if (IsInHitTest) return; else base.OnRender(chartControl, chartScale);
                    }​
                    Bruce DeVault
                    QuantKey Trading Vendor Services
                    NinjaTrader Ecosystem Vendor - QuantKey

                    Comment


                      #11
                      QuantKey_Bruce many many many thanks!

                      I can move the chart with the code you have provided me.

                      Awsome!

                      Many thanks for your help!

                      Comment

                      Latest Posts

                      Collapse

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