Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IsAutoScale parameter doesn't work in Draw.Text() and Draw.Ray()

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

    IsAutoScale parameter doesn't work in Draw.Text() and Draw.Ray()

    8.0.0.14 64-bit, NinjaTrader Continuum Demo account.

    Draw.Text() bug Recurrence steps:
    1. use the drawing tools to draw some objects on chart;

    2. in your indicator, call Draw.Text() with IsAutoScale=true, and set y value beyond current chart's y-axis range; then call ForceRefresh();

    3. open the chart's "Drawing Objects" window, you can see the text object drawn by your indicator, it's IsAutoScale property is checked, that's right. click Cancel to close window.

    4. but you can't see the text on chart, unless you click on some other drawing object like you drew in step 1, then the y-axis will auto scale and the the text will be shown.

    So the IsAutoScale parameter doesn't work actually.


    Draw.Ray() bug Recurrence steps:
    1. in your indicator, call Draw.Ray() with IsAutoScale=true, and set y value beyond current chart's y-axis range; then call ForceRefresh();

    2. open the chart's "Drawing Objects" window, you can see the line object drawn by your indicator, it's IsAutoScale property is unchecked, that's not right at all! click Cancel to close window.

    3. so you can't see the line on chart unless you adjust the y-axis range to include the line y value. it's even useless to click on some other object.

    #2
    Hello,

    Thank you for the post, unfortunately I am not seeing the same outcome as you have described. While using autoscale and drawing from NinjaScript, I do see the scale is applied correctly.

    Do you have a simple example that shows the syntax you are using and where you are calling ForceRefresh?

    In general a force refresh should not be needed as the tools would be rendered once drawn, but depending on your specific case potentially you do need it for something. If you can provide a sample of the tests you are conducting that would be helpful.

    Please let me know if I may be of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      My indicator is too complex to show you, I'll rewrite a simple sample for this. Please waiting...

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Hello,

        Thank you for the post, unfortunately I am not seeing the same outcome as you have described. While using autoscale and drawing from NinjaScript, I do see the scale is applied correctly.

        Do you have a simple example that shows the syntax you are using and where you are calling ForceRefresh?

        In general a force refresh should not be needed as the tools would be rendered once drawn, but depending on your specific case potentially you do need it for something. If you can provide a sample of the tests you are conducting that would be helpful.

        Please let me know if I may be of further assistance.

        Attached DrawSample.zip is indicator.

        Recurrence steps:
        1. disconnect and DO NOT connect to any data feed, the test must under the context that the price doesn't change.

        2. open 6B 30min chart, wait for historical data loading complete, then keep enough margin on the right for better observation, then use Drawing tool to draw a text "aaa" on chart. see preparation.jpg;

        3. add DrawSample indicator to chart, note the Panel parameter must be "same as input series", see add_indicator.jpg;

        4.click the "Draw S/R" button on the toolbar;

        5.you'll see the there's "Click me" on the chart, but can't see the horizone line and the "See me?" text above the line. DO NOT do anything now, including shift bars or click on chart or hide/minimize window; see button_clicked.jpg;

        6. click on the "Click me" or "aaa", you can see the the horizone line and the "See me?" text above the line. Of course, if you shift bars or hide/minimize window then restore, you can see them too. see clickme_clicked_jpg;

        7. check the line's property, you can see the "Auto Scale" of line is UNCHECKED, see line_property.jpg

        8. although the "Auto Scale" of text is checked, but it doesn't work actually as I said above.
        Attached Files

        Comment


          #5
          Sorry but there's limit to upload only 5 attached files, I have to attach the DrawSample.zip indicator here. It draw a line and a text above the line, they are beyond the y-axis of chart; In addition, it also draws a test text inside the y-axis for you to click on it to test.
          Attached Files

          Comment


            #6
            Hi, Jesse

            Please let me know if you see my replies

            Comment


              #7
              Hello,

              Thank you for providing the sample.

              In this case I would expect the result you are getting aside from the Ray not having autoscale checked.

              The ForceRefresh does not "force" as the name suggests, it simply sets a internal marker that the chart is dirty and needs re rendered. This would also entail that one of the events required for OnRender to run happens as well.

              If you are disconnected and there are no changes to the chart from the list of items here there would be no reason for the chart to need to re render. Because these items are being added from a button handler after the render, the objects would need to wait for an event to occur that would cause OnRender to be called. You can create a situation for the chart to need to re render in this case.

              Rather than using ForceRefresh, you could just draw a dummy object and remove it like the following:

              Code:
              Draw.Dot(this,"reloadRenderDot", false, 0, 0, Brushes.Transparent);
              RemoveDrawObject("reloadRenderDot");
              This could be placed where you currently have ForceRefresh in the buttons handler. I wouldn't necessarily suggest this as a fix for anything other the case of using a button handler and needing to reload the autoscale while disconnected.

              Regarding the Ray, I do see the autoscale is not being applied to the object, so for that I will provide that information to development for further review.

              Please let me know if I may be of further assistance.
              JesseNinjaTrader Customer Service

              Comment


                #8
                Not sure this will help, but I have been using
                Code:
                            ChartControl.InvalidateVisual();
                to force a refresh (re-render), and it has generally worked for me vs using ForceRefresh.

                Comment


                  #9
                  Originally posted by aslane View Post
                  Not sure this will help, but I have been using
                  Code:
                              ChartControl.InvalidateVisual();
                  to force a refresh (re-render), and it has generally worked for me vs using ForceRefresh.
                  Thank you, Jesse

                  Do u agree with aslane's suggestion? I noticed ForceRefresh() help has a note:
                  You should only call ForceRefresh() if the chart truly needs to be visually updated. It is NOT recommended to invalidate the chart control directly as this could cause issues with threading which result in dead locks.
                  so ChartControl.InvalidateVisual() is not a good alternative,right?

                  Comment


                    #10
                    Hello,

                    Thank you for the reply.

                    Yes I would agree in this case, this is not a documented method and is also hinted that it should not to be used in the help guide. If possible I would always suggest using the mechanisms that are already in place. Internal actions are all tested based on how the platform should operate, in the case internal methods are used out of that context we cant really put an expectation on that.

                    For this, invoking the render by removing an object Is likely what I would suggest over a forced action mainly because the chart is already set up to detect that case. ForceRefresh is really the only suggested refresh method to use, if the case is that this doesn't work for the specific use, you could look more closely at what the platform already looks for to find a work around.

                    I am sure there are certainly situations where neither of these options would be viable, and in those specific cases I would generally ask that you provide a sample to our support so we can review it. If that scenario is something that should be supported we could always look at adding feature requests.

                    I look forward to being of further assistance.
                    JesseNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by bortz, 11-06-2023, 08:04 AM
                    47 responses
                    1,603 views
                    0 likes
                    Last Post aligator  
                    Started by jaybedreamin, Today, 05:56 PM
                    0 responses
                    8 views
                    0 likes
                    Last Post jaybedreamin  
                    Started by DJ888, 04-16-2024, 06:09 PM
                    6 responses
                    18 views
                    0 likes
                    Last Post DJ888
                    by DJ888
                     
                    Started by Jon17, Today, 04:33 PM
                    0 responses
                    4 views
                    0 likes
                    Last Post Jon17
                    by Jon17
                     
                    Started by Javierw.ok, Today, 04:12 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post Javierw.ok  
                    Working...
                    X