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

ChartScale MinValue / MaxValue wrong

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

    ChartScale MinValue / MaxValue wrong

    I am working with a DrawingTool in the IsVisibleOnChart function and the returned values for chartScale.MinValue / MaxValue are wrong. There is are 2 properties called SaveScaleMax / SaveScaleMin which appear to have the correct values for the chart. This used to work correctly when I made the drawing tool last year
    Click image for larger version

Name:	image.png
Views:	47
Size:	113.1 KB
ID:	1294940

    #2
    Hello habibalex,

    Thanks for your post.

    Have you added prints in the script for the SaveScaleMax, SaveScaleMin, chartScale.MaxValue, and chartScale.MinValue properties within the script?

    What is the print output reporting for those properties in the NinjaScript Output window?

    Please share a reduced test script with use that reproduces the behavior and the exact steps you used to reproduce the behavior so we may investigate this matter further.

    Note that a reduced copy refers to a copy of the script that contains the minimum amount of code needed to reproduce the issue. All other code is commented out or removed.

    To create a copy of your script to modify, open a New > NinjaScript Editor, select your script, right-click in the Editor, select 'Save as', name the script, and click OK.

    To export the test script, go to Tools > Export > NinjaScript AddOn.

    We look forward to assisting further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      I've added a Print for IsVisibleOnChart for chartScale.MaxValue / MinValue.
      Print("return false AVWAP " + chartScale.MinValue + " " + chartScale.MaxValue); // selected
      Print("return true AVWAP " + chartScale.MinValue + " " + chartScale.MaxValue); // not selected

      SaveScaleMax / Min is not available through the chartScale object ( looks like it's internal or private )

      When I select and unselect the drawing tool with my mouse by clicking near it, I noticed that chartScale.MinValue / Maxvalue changes. I made a test script which shows the same thing

      Click image for larger version

Name:	image.png
Views:	40
Size:	7.9 KB
ID:	1295208

      Comment


        #4
        Hello habibalex,

        Thanks for your notes.

        I was able to reproduce the reported behavior and it appears the chartScale.MinValue and chartScale.MaxValue is printing values related to where the mouse is being clicked.

        I have reported this behavior to the Development team so that they may investigate the matter further.

        Once the Development team is finished investigating the behavior I will update this forum thread with their findings.

        Thanks for reporting this! We look forward to assisting further.

        Brandon H.NinjaTrader Customer Service

        Comment


          #5
          Hello habibalex,

          Thanks for your patience.

          The Development team has finished investigating this behavior.

          They have reported that this is the expected behavior for chartScale.MinValue and chartScale.MaxValue for performance reasons when performing a hit test.
          Brandon H.NinjaTrader Customer Service

          Comment


            #6
            What's the logic behind the values that are returned? if it's not the chart min and max, it must be something? Seems an odd choice to return random values. It'd be better if a flag or null values were returned that indicated it was unknown rather than random values.

            Comment


              #7
              Originally posted by habibalex View Post
              What's the logic behind the values that are returned? if it's not the chart min and max, it must be something? Seems an odd choice to return random values. It'd be better if a flag or null values were returned that indicated it was unknown rather than random values.
              Hello habibalex,

              Thank you for your patience.

              The reasoning has to do with performance and resource utilization. During a hit test, the values for MaxValue and MinValue are set that way for performance reasons and I believe they are tied to where the mouse is clicked.

              Please don't hesitate to reach out with any additional questions or concerns.
              Emily C.NinjaTrader Customer Service

              Comment


                #8
                I can cache the values but that seems hacky to me. Maybe I shouldn't be using the chartscale min / max to determine the result of IsVisibleOnChart then

                Comment


                  #9
                  Hello habibalex,

                  Thank you for your patience.

                  Our developers have gotten back to us to let us know this is expected for performance reasons due to performing a hit test.

                  Setting class level variables from OnRender() would be the workaround.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by lightsun47, Today, 03:51 PM
                  0 responses
                  5 views
                  0 likes
                  Last Post lightsun47  
                  Started by 00nevest, Today, 02:27 PM
                  1 response
                  9 views
                  0 likes
                  Last Post 00nevest  
                  Started by futtrader, 04-21-2024, 01:50 AM
                  4 responses
                  45 views
                  0 likes
                  Last Post futtrader  
                  Started by Option Whisperer, Today, 09:55 AM
                  1 response
                  14 views
                  0 likes
                  Last Post bltdavid  
                  Started by port119, Today, 02:43 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post port119
                  by port119
                   
                  Working...
                  X