Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RemoveDrawObjects not work in strategy

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

    RemoveDrawObjects not work in strategy

    RemoveDrawObjects not work in strategy

    My strategy is updating DrawTextFixed text, but its overlapping older text.
    same tag, also try to use RemoveDrawObject("tag")

    RemoveDrawObjects() works, but it also removes other items.

    #2
    jokujoku, which code are you using here? It would be expected that the RemoveDrawObjects call would clear up all programmatically drawn objects regardless of the tag used.

    Comment


      #3
      Inside strategy its not working.
      I am updating "status", and its overlaying text,tags, I am using both remove methods.
      Try your self, put diffrent width of text onbarupdate inside strategy, and use background colors, you can see it.

      Even if you reload ninjascript those text hangs in window , only in reply, if you chnage date it clears text.
      Last edited by jokujoku; 02-23-2011, 02:12 AM.

      Comment


        #4
        Can you please share the script you're using in your testing so I can reproduce and look into here? If you don't want to post it on the forums, please submit it to support at ninjatrader dot com to my Attn. Thanks

        Comment


          #5
          Its a strategy and not want share.

          My code is calling every 1 minute status update and here is code.
          Call that, with different width text


          private void StatusR(string tx,int colr)
          {
          RemoveDrawObject("star");
          //RemoveDrawObjects();

          if(colr==1)
          DrawTextFixed("star", tx, TextPosition.TopRight, Color.White,new Font("Arial", 11, FontStyle.Bold), Color.Empty, Color.Blue, 3);

          if(colr==2)
          DrawTextFixed("star", tx, TextPosition.TopRight, Color.White,new Font("Arial", 11, FontStyle.Bold), Color.Empty, Color.Maroon, 3);

          if(colr==3)
          DrawTextFixed("star", tx, TextPosition.TopRight, Color.White, new Font("Arial", 11, FontStyle.Bold), Color.Empty, Color.Green, 3);

          if(colr==0)
          DrawTextFixed("star", tx, TextPosition.TopRight, Color.White, new Font("Arial", 11, FontStyle.Bold), Color.Empty, Color.Black, 3);
          }
          Last edited by jokujoku; 02-24-2011, 07:20 AM.

          Comment


            #6
            I tried with a simple strategy here which you find attached, I don't see any issue therefore I would suggest you simplify and debug your custom code used to isolate the issue.
            Attached Files

            Comment


              #7
              I repeat again, use different lenght of text when updating , your strategy is using fixed lenght, of course you cant' find problem.

              Also use my code block what i posted ealier.

              You are only updateing one time, and also you are not using background.
              Last edited by jokujoku; 02-25-2011, 12:40 AM.

              Comment


                #8
                Ok, here's an updated sample, removing and updating the same object 2 times with different background, colors and wide used - it works as expected for me - please simplify and debug your custom code to track down why you would see issues on your end.

                Thanks,
                Attached Files

                Comment


                  #9
                  You can see my code which is updating "status" and its not working.
                  there is overlapping text.
                  This same kind of problems happend DMIPLUS3 indicator what you can downlaod from big mike site.
                  Also you can find from this site, other people have also problems.

                  My code is calling StatusR inside OnbarUpdate, there is no place where I use DrawtextFixed.
                  inside Onstartup.

                  How your logic work in your example, you are using firstick of bar, and calculte on bar close=true !!!


                  please use it calculate on bar close=false,
                  this is from your help file
                  Definition
                  Indicates if the incoming tick is the first tick of a new bar. This property is only of value in strategies that run tick by tick which is when the CalculateOnBarClose property is set to false.
                  Last edited by jokujoku; 02-25-2011, 10:04 AM.

                  Comment


                    #10
                    here is image

                    So here is image, you can see it not working.
                    You can see my code in ealier post.
                    I am calling StatusR from ONbarupdate
                    calculateonbarclose=false

                    use my code, not yours where is constant, and you are using firtstickofbar even your property calculateonbarclose=true, which is error,
                    Attached Files
                    Last edited by jokujoku; 02-25-2011, 10:28 AM.

                    Comment


                      #11
                      jokujoku, I can see that it does not work as you would expect, however to investigate and test further for you I would need a simplified code snippet that shows the issue, as if you ran the basic example I provided for you, you would see the basic function calls are working as expected. I can understand if you don't want to share it on the forums, for that reason feel free to contact me at support at ninjatrader dot com.

                      Thanks for your understanding,

                      Comment


                        #12
                        I will not send my all code.
                        here is how I call it:
                        inside OnbarUpdate,

                        StatusR("AUTOMATIC",3);


                        sta="NO TRADING TIME"
                        StatusR(sta,3);

                        I don't understand why you don't use is your example, code what i posted,
                        also don't use constant.
                        Last edited by jokujoku; 02-25-2011, 01:05 PM.

                        Comment


                          #13
                          Originally posted by jokujoku View Post
                          So here is image, you can see it not working.
                          You can see my code in ealier post.
                          I am calling StatusR from ONbarupdate
                          calculateonbarclose=false

                          use my code, not yours where is constant, and you are using firtstickofbar even your property calculateonbarclose=true, which is error,
                          Actually different lengths of text have nothing to do with the problem. The problem is ENTIRELY due to the CalculateOnBarClose = false, no matter how set; within code or from the config GUI. I have come across the problem in ALL my indicators that draw text of any kind, not just DrawTextFixed. The only way that I have been able to overcome it is to use a filter so that not every tick updates the text, or else to use FirstTickOfBar to ensure that the text is drawn only once per bar. A great many of my indicators do use CalculateOnBarClose = false, which is why I saw the problem too.

                          Comment


                            #14
                            Thanks for your help koganam.
                            Anyhow my strategy is updating firstickofbar, and still this problem occurs.
                            Last edited by jokujoku; 02-26-2011, 06:10 AM.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            633 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            364 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            105 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            567 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            568 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X