Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BarIndependent Drawing

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

    BarIndependent Drawing

    Hello,

    I want to ask please about drawing independent from dataseries.

    When I have in the indicator COBC = false and when condition is true the indicator should plot on price panel a diamond above the high and in panel 2 with volume indicator and in panel3 with MACD histogram the backcolor in a certain color.

    Both drawings are done when condition is true and independent from close of bar? Or will the backcoloring be somehow related to the volumebar or histogram?

    And the 2nd question in this concern is please that my diamond is plotted so often (I understand the logic with COBC=false, that every time condition is true it plots the same distance from the high) But I thought I can remove the diamond before the new one is plotted with

    RemoveDrawObject("Max");
    DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);

    But it looks like the attached screenshot.

    Thank you
    Tony
    Attached Files

    #2
    Originally posted by tonynt View Post
    Hello,

    I want to ask please about drawing independent from dataseries.

    When I have in the indicator COBC = false and when condition is true the indicator should plot on price panel a diamond above the high and in panel 2 with volume indicator and in panel3 with MACD histogram the backcolor in a certain color.

    Both drawings are done when condition is true and independent from close of bar? Or will the backcoloring be somehow related to the volumebar or histogram?
    You have CalculateOnBarClose = false. That means that the bar close is irrelevant: you are processing on every tick, including said tick that closes the bar.
    And the 2nd question in this concern is please that my diamond is plotted so often (I understand the logic with COBC=false, that every time condition is true it plots the same distance from the high) But I thought I can remove the diamond before the new one is plotted with

    RemoveDrawObject("Max");
    DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);

    But it looks like the attached screenshot.

    Thank you
    Tony
    You are removing the object tagged "Max", and drawing an object called "Max + CurrentBar". The object that you are removing is not the object that you are drawing. Correct the code to remove the same object that you are drawing.

    Comment


      #3
      Thank you for your reply.

      So, I changed to
      RemoveDrawObject("Max" + CurrentBar);
      DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);

      and it looks same as plotting new diamond but doesn´t remove the other one.

      When I remove in both lines the "+ CurrentBar"then it plots only one Diamond, but not on the actual bar where it should be with COBC=false. the diamond is plotted the bar before

      Thank you
      Tony
      Last edited by tonynt; 08-20-2015, 01:46 PM. Reason: Translation error

      Comment


        #4
        Originally posted by tonynt View Post
        Thank you for your reply.

        So, I changed to
        RemoveDrawObject("Max" + CurrentBar);
        DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);

        and it looks same as plotting new diamond but doesn´t remove the other one.

        When I remove in both lines the "+ CurrentBar"then it plots only one Diamond, but not on the actual bar where it should be with COBC=false. the diamond is plotted the bar before

        Thank you
        Tony
        If you want it to draw on the CurrentBar, use this line ONLY.
        Code:
        DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);

        Comment


          #5
          Thank you for your reply again.

          Then we are back at the beginning. There were plotted so many Diamonds. Therefore I added the RemoveDrawingObject that was not correct as you replied. Thank you for this information.

          So, with this information it is possible to have many Diamonds on the current bar or one Diamond the bar before, but not one DrawingObject with COBC=False



          Thanks
          Tony

          Originally posted by koganam View Post
          If you want it to draw on the CurrentBar, use this line ONLY.
          Code:
          DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);

          Comment


            #6
            Originally posted by tonynt View Post
            Thank you for your reply again.

            Then we are back at the beginning. There were plotted so many Diamonds. Therefore I added the RemoveDrawingObject that was not correct as you replied. Thank you for this information.

            So, with this information it is possible to have many Diamonds on the current bar or one Diamond the bar before, but not one DrawingObject with COBC=False



            Thanks
            Tony
            That should leave you with one and only one diamond on any bar on which it is called, no matter the value of CalculateOnBarClose.

            Comment


              #7
              ???

              This is the result to my question and your first reply?

              You know that drawings are used to verify certain situations, and because of COBCfalse right at the time. So how one knows what is it referring to when it is plotted not where it should be?

              And when condition is not true anymore the DrawingObject isnt there anymore?
              Last edited by tonynt; 08-20-2015, 02:38 PM.

              Comment


                #8
                Originally posted by tonynt View Post
                ???

                This is the result to my question and your first reply?
                Yes. This line should result in one and only one diamond on a bar, if the conditions are met.
                Code:
                DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);
                You know that drawings are used to verify certain situations, and because of COBCfalse right at the time. So how one knows what is it referring to when it is plotted not where it should be?
                If it is not where you expect it to be, then your code is not doing what you want it to do. You can always check the properties of the diamond and check the tag to see if your code even put the tag there that you were expecting. If the tag is not what you expect, then it means that your code is not written to do what you want it to do. Without seeing your code, there is no way to tell you where the code may not be quite correct for what you want to do. I can only tell you what to expect if your code were to be correctly written, and hence also be able to tell you that if you are not seeing what you expect to see, then your code is not written to do what you expect.
                And when condition is not true anymore the DrawingObject isnt there anymore?
                That is a different queston. If you want to remove the diamond when the conditions are no longer true, then you have to write a separate condition for that and use it to RemoveDrawObject().

                Comment


                  #9
                  Thank you for your reply. This is clear and I understand.
                  And the code is plotting correctly as with COBC=false it plots the DrawingObject when true, and so there are more than one drawingobjects at this bar. This is working correctly.

                  I only want to add to the code that the drawingobject(s) that have been plotted before (and when it is working correctly there should always be only one, as every time a new on is plotted the one before is removed) are removed before the new DrawingObject is plotted. There is no other condtion for removing. There should be only one (the most recent plotted) DrawingObject on the current bar and not the others before.

                  And as this is that simple I´m wondering why it cant be done.

                  Best
                  Tony

                  Comment


                    #10
                    That is the way this should be working. Using:
                    DrawDiamond("Max" + CurrentBar, false, 0, High[0] + 10 * TickSize, Color.Magenta);
                    Should only show one object per bar. The object is simply re-drawn on each tick in its new position from the bar without having to erase it. To remove if the condition is false you need to test and use RemoveDrawObject(). A completely new object should only occur on the next bar because the 'CurrentBar' number in the tag has changed. If this is not occurring as expected there is something else going on that needs tracking down.
                    eDanny
                    NinjaTrader Ecosystem Vendor - Integrity Traders

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by MSerag, Yesterday, 11:52 PM
                    2 responses
                    20 views
                    0 likes
                    Last Post MSerag
                    by MSerag
                     
                    Started by James650, Today, 08:25 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post James650  
                    Started by ETFVoyageur, 04-30-2024, 06:05 PM
                    11 responses
                    80 views
                    0 likes
                    Last Post NinjaTrader_ChelseaB  
                    Started by Rogers101, 05-05-2024, 11:30 AM
                    13 responses
                    39 views
                    0 likes
                    Last Post Rogers101  
                    Started by dcriador, Yesterday, 01:43 AM
                    4 responses
                    25 views
                    0 likes
                    Last Post NinjaTrader_Jesse  
                    Working...
                    X