Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Text Obj Anchors

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

    Moving Text Obj Anchors

    Can Anyone provide some simple code to Move the two Text Object Anchors to a different Bar and Different Price without using Draw.Text with the same tag ?


    Thanks
    Jerry

    #2
    Hello Jerry,

    Attached is an example that shows how to change the slot index and anchor of a drawing object.
    Attached Files
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Ahhhh Slot index !! - that was my problem

      I sent to Patrick a modified TestTextTool that repeats the error I have been getting that we discussed some time ago. I could not find reference to that email chain so I sent it to patrick.
      Further it looks like the error is in Draw.Text not updating Objects without generating Errors and then boom. So I am going to use this technique to Move the objects rather than using Draw.Text with the same Tag. Hopefully that gets around the problem. I will try the same with the test program.

      A Big Thanks
      Jerry

      Comment


        #4
        Even using this method I still get " On Render Errors" using a simple text draw indicator in Playback. There is a definite bug here that needs to be addressed.

        Comment


          #5
          Hello Jerry,

          To confirm, you are testing the script that I have posted in Playback with Market Replay Data and this is causing a rendering error when the Playback is first connected?
          After the script begins processing real-time data?
          After changing the playback time with GoTo or the slider?
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Originally posted by NinjaTrader_ChelseaB View Post
            Hello Jerry,

            To confirm, you are testing the script that I have posted in Playback with Market Replay Data and this is causing a rendering error when the Playback is first connected?
            After the script begins processing real-time data?
            After changing the playback time with GoTo or the slider?

            Yes, and no, I changed the script to add a data Stream and it draws for both streams.
            Not when first connected, after Playback is running for some time.
            Have not played with Real time or Changing the Slider as I get the error just letting it run.

            attached is the indicator and workspace.
            I Let it run from last week in december to present and it errors out around 1/4 - 1/9
            I watched Memory use etc. but nothing of note.
            Attached Files

            Comment


              #7
              Hello Jerry,

              The TestTextSimpleDrawingTool does not appear to be related to what we are discussing in this thread of moving a text object by modifying the anchor.

              Would this be ok to move to a new thread.

              The issue is that you are calling Draw.Text() while a secondary series is added to your script and re-using a tag name and this is causing a rendering error, is this correct?

              The script you have appears to be drawing two new objects on each primary bar on the chart. It does not appear to be moving an object.

              Is the issue that after drawing too many objects NinjaTrader is running out of memory?
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello Jerry,

                The TestTextSimpleDrawingTool does not appear to be related to what we are discussing in this thread of moving a text object by modifying the anchor.

                Would this be ok to move to a new thread.

                The issue is that you are calling Draw.Text() while a secondary series is added to your script and re-using a tag name and this is causing a rendering error, is this correct?

                The script you have appears to be drawing two new objects on each primary bar on the chart. It does not appear to be moving an object.

                Is the issue that after drawing too many objects NinjaTrader is running out of memory?
                It is related in that when I added the Second data Stream with the move. I initially thought the move was causing the problem. So I implermented the Anchor move but still got the error. It is fine with me to move this to a new thread.

                It is moving an object. Because the tag for the lower time frame is changed on the Higher time frame the lower time frame object is moved by draw.text() for each bar in between.

                No it is not running out of Memory or even coming close. That is why I monitored it.

                Comment


                  #9
                  Hello Jerry,

                  Using the script that I have provided, are you able to reproduce the error?

                  This is a simple script that draws an object once, and then moves the object once on the last bar.

                  This would be a simple test to see if changing the slot of the anchor is causing an issue without any other code that is not necessary to reproduce the behavior.
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    When I tested with your single Data series version, I was unable to reproduce the error. However in Retrospect I am not sure I tested for a long enough Span of time.
                    I will retest. However, It seems that 8.03 has introduced a different failure mode.
                    This now referring to my full indicator.

                    After running all day about 10 minutes ago I noticed things were not right.
                    there is no Error message i.e. On Render etc.
                    But new objects get created and then stop. They don't get moved.
                    Nor do they get redrawn with the final position color and position.
                    This occurs with Both text and lines.
                    Past manually drawn text on the screen loses its font color which reverts to transparent.
                    In the months of running NT8 these behaviors have not happened with the exception of the font change on Manual objects which ALWAYS occurred with the OnRender Error message.

                    So I will test the Script as currently written first to see if it fails as it has in the same mode with 8.03
                    then I will modify it back to the original test tool you sent to me and run it again.

                    Comment


                      #11
                      So I retested in Several modes.
                      1) One Data Stream on Chart. Simple Indicator which only references root data series and draws on every bar.

                      Result - No Errors

                      2) Two Data Streams on Chart- Same Indicator which only references root data series and draws on every bar.

                      Result - A blast of a couple hundred errors.

                      My interpretation is that, I think this makes it very clear that a second data stream on the chart some how interferes with Draw.Text even if the indicator does not access this second data stream.

                      Attached is the Indicator and the Workspace that resulted in the errors. You can delete the Second data stream from the workspace to see that you can run it an not get any errors.
                      Attached Files

                      Comment


                        #12
                        Hello Jerry,

                        To ensure the issue is not due to a secondary series being added to the script, I have modified the script to add a secondary series, updates the drawing object when the secondary series is processing, draws using the price data from the secondary series, but draws on the primary series on the chart.

                        You have also mentioned that the script continues to move the object and the error occurs after the script has been running for some time.

                        Attached is the script I have tested and screenshots that show I've been running the script from 11:44 AM to 3:36 PM (about 4 hours) and I was not able to reproduce any error.

                        Please test this script that I have provided that uses a secondary series and updates on each new bar and let me know if you are able to reproduce the behavior.
                        Attached Files
                        Chelsea B.NinjaTrader Customer Service

                        Comment


                          #13
                          Chelsea
                          I got a note back from Patrick who indicated he did replicate the behavior with what I sent. I am assuming therefore you are in agreement with this and looking to fine tune the behavior. I just want to make sure we are on the same page.
                          1) Your new script significantly diverges from what I am using in my full script. I use All tick bars for one. Your script uses minute bars.
                          2) The failure mode I showed used your basic script but added the series only on the chart not in the indicator. But it added it using Box Candle style. I think this may be significant as it may be the boxes that are interfering with the draw.Text.
                          3) In My full indicator which does many types of text drawings so much more is going on the Errors will occur several times a day. In the simple script in order to randomly recreate the situation I find I have to run using playback for many Days. If I start before the first of the year 12/30 I hit the errors anywhere from 1/4- 1/9. So you have not run it anywhere near long enough.

                          All that being said, I generally agree with your thinking as I had thought about testing the simple script with the following conditions. All using the original compression ticks charts as posted.

                          1) Simple script using one time frame only. But second data series added to chart with different Bar style, maybe even invisible if possible to eliminate the Bar drawing as interference.
                          2) Simple script using one time frame only but second data series using box style in different Panel.

                          I think based on the results of these tests the Script Should be modified.

                          Let me know how you would like me to proceed.
                          Last edited by JerryWar; 01-12-2017, 12:09 PM.

                          Comment


                            #14
                            Hello Jerry,

                            Thank you for letting me know you are working with another technician on the same issue.

                            I will let NinjaTrader_PatrickH continue assisting you moving forward.

                            As a tip, I am creating these samples to test specific items that you are specifically stating are causing an error without including any code that is not absolutely necessary to reproduce the behavior using C# coding conventions for easy readability. This is so that if we are able to reproduce the behavior, we can submit the script to our development.
                            Further, I would highly recommend you list all of the steps necessary to reproduce the behavior so that we may attempt to reproduce the behavior on our end (i.e. using the Playback over 5 days of day at max speed, using 1 tick as the secondary series, etc)
                            Chelsea B.NinjaTrader Customer Service

                            Comment


                              #15
                              Chelsea,
                              I have included all that info for the issue even including the workspace. But I see that some of the important details were splashed over several posts. I can see the confusion. With any new Posts I will start including a test file which includes all the details in one place.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by frankthearm, Yesterday, 09:08 AM
                              11 responses
                              41 views
                              0 likes
                              Last Post frankthearm  
                              Started by junkone, Today, 11:37 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post junkone
                              by junkone
                               
                              Started by quantismo, 04-17-2024, 05:13 PM
                              5 responses
                              35 views
                              0 likes
                              Last Post NinjaTrader_Gaby  
                              Started by proptrade13, Today, 11:06 AM
                              1 response
                              6 views
                              0 likes
                              Last Post NinjaTrader_Clayton  
                              Started by love2code2trade, 04-17-2024, 01:45 PM
                              4 responses
                              34 views
                              0 likes
                              Last Post love2code2trade  
                              Working...
                              X