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

Ghosting in Draw.TextFixed

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

    Ghosting in Draw.TextFixed

    I use Draw.TextFixed to draw in the bottom left of the chart using my strategy. I also change the colors sometimes when I updated it.

    I'm running 2 strategies on different symbols in 2 different chart tabs of the same window.

    One of my strategies, in this text fixed area - I can see the background in another color, text is being overwritten. What I mean is the foreground text I can read completely. But behind it is some other text. I have opacity @ 50.

    But I wonder where this text comes from? it is the type of text generated by the strategy, I can see parts of it that give it away like '[' that I use

    But I'm wondering is this just from the strategy running in that chart? or from the strategy running (same strategy .cs) in the other tab?

    I have never noticed this before running only one instance of the strategy at a time.

    Also, that tab with the problem was mostly in the background most of the time.


    #2
    Hello NinjaCustomer,

    Thanks for your post.

    Please check your code for the strategy you are running on the chart.

    If you are using a unique tag name in Draw.TextFixed() then this can certainly occur when you are placing the text in the same place. This is one situation where you would want to use the same tag name so that the previously written text is automatically removed. Alternatively, you can use RemoveDrawObject("tagname") before using the next occurrence of Draw.TextFixed() if you need to use unique tag names.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      nope, the tags are static.

      I have a ForceRefresh() call immediately afterwards. Could that be problematic? it's just setting a flag, right?

      Comment


        #4
        it uses this call - owner is this (the Strategy)Click image for larger version  Name:	2019-04-18_20-39-42-772.png Views:	1 Size:	6.1 KB ID:	1054723

        Comment


          #5
          Hello NinjaCustomer,

          Thanks for your replies.

          If you are using ForceRefresh() because you are updating the draw object, it would not be needed as, "Drawing object(s) have been removed from the chart" would cause that to occur. If indeed you are using the same tag name then the drawText will be automatically removed prompting an automatic call to ForceRefresh().

          Reference: https://ninjatrader.com/support/help...rcerefresh.htm

          You may want to comment out your ForceRefresh() and test to see if that resolve the issue.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            I'm calling it because I call the screenshot code right after and want to make sure that the this status text is drawn on the chart - so that is not necessary?

            ah I just re-read what you wrote.. so all Draw method calls implicitly call ForceRefresh()?

            Comment


              #7
              Hello NinjaCustomer,

              Thanks for your reply.

              From the help guide on ForceRefresh():

              ChartControl runs a timed event every 250ms to determine the chart needs to be updated. If it does, the OnRender() method is called. Under normal circumstances, the marker used to call OnRender() will be reset after the following conditions:

              •OnBarUpdate() event

              •OnConnectionStatusUpdate() event

              •User clicks on the chart

              •Drawing object(s) have been removed from the chart

              •Strategy enabled/disabled on chart

              •ChartTrader enabled/disabled

              In most cases, the conditions listed above should be satisfactory for rendering standard and custom chart objects; however for more advance programming concepts, there may be other situations you run into which would NOT force the chart to refresh (e.g., a user interacting with a custom control ). In these special cases, you can use the ForceRefresh() method to re-queue the render event.


              Reference: https://ninjatrader.com/support/help...rcerefresh.htm
              Paul H.NinjaTrader Customer Service

              Comment


                #8
                thanks, I'm having some problems now with CloseStrategy() - normally it works fine for me.. but I've run into a situation where it will not disable the strategy when called.

                Usually I call it from methods originating in OnBarUpdate()

                but is it safe to call it from OnAccountItemUpdate () ?

                Comment


                  #9
                  Hello NinjaCustomer,

                  Please consider creating a new thread when changing subjects as this is not related to ghosting in Draw.text...

                  For the close strategy, please review the help guide: https://ninjatrader.com/support/help...sestrategy.htm


                  Paul H.NinjaTrader Customer Service

                  Comment


                    #10
                    I believe the problem occurs because I have multiple draw objects ... I mean.. the strategy created them - but for some reason I have multiple draw objects on the chart with the exact same name.. so names don't need to be unique? I was thinking that by using that if I didn't change the name in the strategy call to Draw.TextFixed that it would just overwrite the old one.. but I have 2 instances of these objects on the chart.. on charts without this "ghosting", I only have one.

                    Comment


                      #11
                      I think I figured it out - I have 2 strategies on the chart.. 2 instances of the same strategy. only one runs at a time.. but i guess I need to remove the draw object after i stop it

                      Comment


                        #12
                        Hello NinjaCustomer,

                        Thanks for your replies.

                        Once a strategy is disabled/stopped, it would automatically remove any drawn objects it created.
                        Paul H.NinjaTrader Customer Service

                        Comment


                          #13
                          hmm, that is strange then - can you think if any reason a Strategy would have created 2 drawing objects with the same name? I can see them on the chart's drawing object list as having the same name.

                          Comment


                            #14
                            Hello NinjaCustomer,

                            Thanks for your reply.

                            Are these of the same drawing object type (Ie: are they both Draw.textFixed() drawn?).

                            I would suggest isolating the issue to a single chart, single strategy.
                            Paul H.NinjaTrader Customer Service

                            Comment


                              #15
                              for the specific tag name, let's call it 'A'

                              it is the same call from the same strategy e.g. Draw.TextFixed(this, 'A', ...)

                              also, I actually have 2 calls to Draw.TextFixed... one for 'A' and one for 'B'

                              and both 'A' and 'B' are duplicated on the chart, so 2 'A's and 2 'B's

                              there is a ForceRefresh() call after each but from what I gathered here, it shouldn't have any affect.

                              also I have 2 instances of the Strategy on the problem chart...

                              also I have several tabs with 2 instances of the Strategy on each chart.. but as far as I understand NinjaTrader, this shouldn't make any difference.

                              sometimes there can be more than one problem chart, but most of the charts are not problem charts. problem charts being charts that have overlayed text on top of each other in the fixed area, and also have 2 copies of 'A' and 2 copies of 'B' drawing objects in the drawing objects list.

                              I can't really isolate right now since I need ninjatrader to run this workspace , however if you can think of any possiblities I should look at - please let me know. I do not explicitly remove any draw objects like I was thinking about earlier.

                              Also even though there are 2 strategies on each chart.. i only ever run 1 of them at a time per chart. They never run on the same instrument concurrently.




                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by itrader46, Today, 09:04 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post itrader46  
                              Started by timmbbo, Today, 08:59 AM
                              0 responses
                              1 view
                              0 likes
                              Last Post timmbbo
                              by timmbbo
                               
                              Started by bmartz, 03-12-2024, 06:12 AM
                              5 responses
                              33 views
                              0 likes
                              Last Post NinjaTrader_Zachary  
                              Started by Aviram Y, Today, 05:29 AM
                              4 responses
                              14 views
                              0 likes
                              Last Post Aviram Y  
                              Started by algospoke, 04-17-2024, 06:40 PM
                              3 responses
                              28 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X