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

clarification

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

    clarification

    Hello, i was trying to check through prior posts to see if i could find any information on this.

    When there is no connection to market data ie on weekend - does the OnRender still get processed every 250ms as stated?

    I have a drawing tool that seems to require an additional click on the chart when there is no market data.

    When there is live data connection the additional click is not required to update the drawing tool data on the chart.

    Can you clarify the above - ie when there is no incoming tick and it connection to OnRender .... ie OnBarUpdate not being called.

    I have looked at perhaps simulating the mouse click for this situation when no live data - i would imagine this is unsupported but in any event would this be possible to simulate the mouse click event ?

    In the code i am doing a ForceRefresh() and invalidating the chartpanel; but from the thread currently open on changing the current fixed 250ms chart OnRender refresh what i understand from this is that it just queues the request?

    Any clarification on the above appreciated

    thanks
    Last edited by explorer101; 10-14-2019, 07:35 AM.

    #2
    Hello explorer101,

    OnRender is only called for specific events, this is not just a timed loop to reload the chart every X milliseconds. If there is something which causes the chart to need to be re-rendered it would be, otherwise no changes would be seen during times when nothing is happening. There is nothing I could suggest to keep the render happening as you would introduce performance issues by doing that. The ForceRefresh tells the chart that it needs to be refreshed at the next possible time, this would likely be for a tick event during normal hours or a manual action like clicking/resizing.

    Can you provide more detail on the need to keep refreshing the chart when there is no connection? You could utilize one of the other playback modes if you needed to drive market data during the weekend for testing.


    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Thanks for the reply.
      I had wondered on the X millisecond reload - the fact it mentions time i had presumed it was on a timed loop - perhaps this is part of the issue contention with users in the thread i mentioned discussing having the refresh rate configurable somewhere. But from what you are implying there would be more to it than just a millisecond change.

      Its not that i need for the chart to keep refreshing - its that i have a specific use case that when i add a custom drawing tool to the chart as mentioned - if i click the chart once an additional time it seems to trigger whatever is needed for OnRender() to be called. This is the case for when there is no data connection.

      As you indicated i also note that if there is no incoming tick even with a live connection for say an instrument that is live but say during low volume hours outside of the US RTH session - it also seems to require a click at times.

      I do not have the IsInHitTest in place - i used while back in the OnRender and used it .... where have option to only process OnRender code if user not clicking on the chart.
      Anyways that aside

      There is something in the click of the chart i would like to understand why this triggers the OnRender - for both cases above with connection and without connection

      I was looking at some microsoft docs as in 'certain conditions' and instances i was looking at simulating the mouse click but again this would only be in certain conditions and not called repeatedly

      thanks

      Comment


        #4
        Hello explorer101,

        I had wondered on the X millisecond reload - the fact it mentions time i had presumed it was on a timed loop - perhaps this is part of the issue contention with users in the thread i mentioned discussing having the refresh rate configurable somewhere. But from what you are implying there would be more to it than just a millisecond change.
        You have the right assumption, it is still a rendering loop but its logical to avoid inefficient rendering. When the render is called its not just displaying a new image, all scripts associated with the render have to recalculate their OnRender so this is not invoked at a steady rate unless events driving the platform delegate that. You are also correct, a configurable refresh rate would only be part of the equation.

        Its not that i need for the chart to keep refreshing - its that i have a specific use case that when i add a custom drawing tool to the chart as mentioned - if i click the chart once an additional time it seems to trigger whatever is needed for OnRender() to be called. This is the case for when there is no data connection.
        I am still a little confused on the requirement here. Do you also see this happen with the standard drawing objects or are you calculating something after the object is placed which needs re rendered? Drawing a Line for example will show up by only drawing it, there is no second click needed to render the line, is that what you are saying that your object requires?



        There is something in the click of the chart i would like to understand why this triggers the OnRender - for both cases above with connection and without connection
        This is just one of the many reasons a chart will render, clicking the chart notifies it you may have moved the chart or done other actions so it needs to update. The same happens for other events like resizing the chart, connecting, removing drawing objects etc.. there are many reasons why a render could be called.

        I was looking at some microsoft docs as in 'certain conditions' and instances i was looking at simulating the mouse click but again this would only be in certain conditions and not called repeatedly
        While you can try this I don't believe this would be a way toward a good solution. I believe it would be better to approach why the object needs re rendered here where other objects appear when drawn while disconnected.


        I look forward to being of further assistance.



        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello,

          Jesse writes ... I am still a little confused on the requirement here. Do you also see this happen with the standard drawing objects or are you calculating something after the object is placed which needs re rendered? Drawing a Line for example will show up by only drawing it, there is no second click needed to render the line, is that what you are saying that your object requires?

          Correct once the key anchors elements of the drawing tool are known - there is some additional calculations that are performed on the range of data and this needs to be re-rendered.
          Hence when i click it helps ... so the key is i have additional data being calculated that then will require a re-render as you say above
          So i am looking at the best/efficient way to accomplish this - without having to click the chart
          But that is why i suggested simulating a click - or perhaps even adding and removing an object programatically would achieve the same effect ? Or does it need to be a user initiated adding or moving object?

          thanks
          Last edited by explorer101; 10-14-2019, 09:22 AM.

          Comment


            #6
            Hello explorer101,

            Would it be possible to re work the logic to work more like the fibonacci tools in how they calculate as they render? I am not sure what your tool does at this point but if it has more than one anchor that would likely be the suggestion to try and compare against the fibonacci's rendering.

            If you instead have a single anchor for the tool, that may be part of the problem as a single anchor virtually relies on the chart if you need to do any more rendering past one frame. A possible solution in this case may be to add a second anchor to make the object a click and click placement, this gives the second click/mouse move event time for rendering the extra changes before clicking again. This could make the tool non-intuitive though so this would be something you could explore if it applies.

            As for causing a render, from a drawing object there is nothing I can really suggest. Removing an object could possibly work but you need a indicator in order to do that. You could not do this directly from the drawing object context.

            I look forward to being of further assistance.

            JesseNinjaTrader Customer Service

            Comment


              #7
              Hello, thanks for guidance and clarification on this today. I believe i have a workaround for this - in most cases there already is a second anchor so that aspect wasn't really an option. The calculation needed is more complex than what can be placed as in the fib tools. The mouse event approach seems to do the trick and will continue to test, it seems to provide a reasonably clean solution and is only on certain cases.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by chbruno, Today, 04:10 PM
              0 responses
              3 views
              0 likes
              Last Post chbruno
              by chbruno
               
              Started by josh18955, 03-25-2023, 11:16 AM
              6 responses
              436 views
              0 likes
              Last Post Delerium  
              Started by FAQtrader, Today, 03:35 PM
              0 responses
              6 views
              0 likes
              Last Post FAQtrader  
              Started by rocketman7, Today, 09:41 AM
              5 responses
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by frslvr, 04-11-2024, 07:26 AM
              9 responses
              127 views
              1 like
              Last Post caryc123  
              Working...
              X