Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Drawing objects not updating

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

    Drawing objects not updating

    What I am trying to do is, if the values called by indicator, specified value, I want an arrow to print, and if the values changes or one value is more than the other I want the arrow to print the new update and remove the other lesser one.
    example: 5 volume up print arrow up or if it changes to 5 volume down, these are in cumulative, I want it to draw the arrow down in replacement and remove the prior arrow printed.
    Currently it will draw the arrow up or down, but leave both on the chart, it wont remove the one that is no longer valid, unless i refresh the chart.
    How do I program this to update a new value and draw new arrow up or down on update of the new value?
    Last edited by hthphillip12; 11-09-2021, 10:10 PM.

    #2
    First pic is before manually refreshing, the second pic is after manually refreshing
    Click image for larger version  Name:	b4 refresh.PNG Views:	0 Size:	9.3 KB ID:	1178005Click image for larger version  Name:	After regresh.PNG Views:	0 Size:	8.6 KB ID:	1178006

    Comment


      #3
      Hi hthphillip12, thanks for posting.

      The drawing tools need a unique Tag parameter to stay on the chart. If you call the Draw.Diamond or Draw.ArrowUp method again with the same tag then the old object will be overridden and the new object will render. You can also be more direct and use RemoveDrawObject and remove any draw object by tag name:


      Best regards,
      -ChrisL

      Comment


        #4
        still having trouble the arrows are drawing and staying on the chart, as the value updates per indicator itll show an arrow for both sides of the value unless I refresh the chart.
        Example, volume up shows 5, then volume down shows 8, at first the volume up draws and arrow, next volume down has become greater, so the arrow should be drawn to the one that has a greater value. This is only happening if I refresh the chart, other wise itll just print both arrows and they will both show on the chart until i refresh the chart.
        Hope this makes sense.
        Also I input the code for the remove draw with the tag for the arrow and it didnt change anything, it did the same exact result as before, I would still need to fresh the chart to get the proper result, is there specific placement for the code line, i input the code in the proper area per the link you shared.
        please inform me of the proper placement.

        Comment


          #5
          Click image for larger version

Name:	arrowb4.PNG
Views:	332
Size:	28.8 KB
ID:	1178118Click image for larger version

Name:	arrowafter.PNG
Views:	322
Size:	27.3 KB
ID:	1178119
          Fist pic is arrows before refresh chart, Second pic is arrows after refresh chart.

          Comment


            #6
            Hi hthphillip12, thanks for your reply.

            Can you share a code file you are using or any example that demonstrates how you are using these drawing objects? Did you confirm that you are using the same Tag parameter to clear the old drawing tool?

            I look forward to hearing from you.

            Comment


              #7
              Click image for larger version

Name:	code sig8unlocked.PNG
Views:	217
Size:	22.2 KB
ID:	1178126

              Comment


                #8
                So i want it to draw arrow for volume up if value is reached, but if the opposing value volume down is greater, then I want it to print a new arrow down and remove the original.
                This process is happening but only if I refresh the chart.
                Last edited by hthphillip12; 11-10-2021, 11:43 AM.

                Comment


                  #9
                  Click image for larger version  Name:	arrowb4.PNG Views:	0 Size:	28.5 KB ID:	1178132
                  Here is another pic of it running right now before i refresh the chart

                  Click image for larger version  Name:	arrowafter.PNG Views:	0 Size:	28.2 KB ID:	1178133
                  Here is after the refresh

                  See how its adding arrows on top and bottom of the same bar, it will only do what I want it to do after the chart is refreshed.

                  Comment


                    #10
                    Hi hthphillip12, thanks for sharing the screen shot.

                    The Tag parameter you are using is getting the CurrentBar appended to the string, so it is getting a unique string for the tag every time it draws. If you want the previous drawing tool to be removed then keep the tag the same each time Draw.ArrowUp is called.

                    Best regards,
                    -ChrisL

                    Comment


                      #11
                      Originally posted by NinjaTrader_ChrisL View Post
                      Hi hthphillip12, thanks for sharing the screen shot.

                      The Tag parameter you are using is getting the CurrentBar appended to the string, so it is getting a unique string for the tag every time it draws. If you want the previous drawing tool to be removed then keep the tag the same each time Draw.ArrowUp is called.

                      Best regards,
                      -ChrisL
                      What I am trying to get it to do is, if volume up shows 5 draw arrow up, if volume down is greater, erase arrow up, draw arrow down, all on the same bar, while keeping the history of the process, and as a new bar builds to update the arrow up or arrow down based on certain value. The process is happening but only when I refresh.

                      How do I make this process work? I am a beginner and am looking for guidance, on the programing only.
                      Last edited by hthphillip12; 11-10-2021, 12:00 PM.

                      Comment


                        #12
                        Hi hthphillip12,

                        You can control the drawing with some C# logic. The indicator also needs to run OnEachTick to change the arrow intrabar as well. See the indicator example attached that compares up volume against down volume and changes the arrow accordingly. It will draw the final result on the first tick of the next bar to keep the history. To test the indicator, place the .cs file within Documents\NinjaTrader 8\bin\Custom\Indicators and compile.

                        Best regards,
                        -ChrisL
                        Attached Files

                        Comment


                          #13
                          Originally posted by NinjaTrader_ChrisL View Post
                          Hi hthphillip12,

                          You can control the drawing with some C# logic. The indicator also needs to run OnEachTick to change the arrow intrabar as well. See the indicator example attached that compares up volume against down volume and changes the arrow accordingly. It will draw the final result on the first tick of the next bar to keep the history. To test the indicator, place the .cs file within Documents\NinjaTrader 8\bin\Custom\Indicators and compile.

                          Best regards,
                          -ChrisL
                          Thank you so much I will look at this and to understand it and implement it to my indicator.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          576 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          334 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          553 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          551 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X