Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

On Render issue NT8

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

    On Render issue NT8

    Is there any way to get the price from a mouse click without using on render?
    I am currently using ChartScale inside OnRender to figure out the price from a mouse click. My issue is if I want to draw a line based on that price, there will be a delay. Onrender is only called every 0.25 seconds and even with ForceRefresh() there is a visible delay between when the user clicked on the screen and the drawing showing up.

    #2
    Hello trader3419,

    Thank you for your post.

    You could in fact create event handlers for the mouse clicks. You can find an article on mouse events at the following link: http://www.codeproject.com/Articles/10570/Mouse-Events

    Please let me know if you have any questions.

    Comment


      #3
      Thank you Patrick. How does that solve my issue of having a delay in the drawing object showing up after I clicked? because currently.
      I click on the screen
      Force Refresh
      On Render(), I now have access to chartscale to get the price and I draw the object
      Force Refresh
      Now the object shows up after onrender is called again
      That is currently what I am doing and what understand happens.

      How can I improve on this so that the drawing object will show up automatically after the mouse is clicked?

      Comment


        #4
        Hello trader3419,

        Thank you for your response.

        Draw the line when mouse click event occurs. Is this some custom drawing inside of OnRender? Is this an Indicator or a Drawing Tool you are building?

        Comment


          #5
          This is an indicator that is getting mouse input and using Draw.Ray inside of OnRender.
          Sorry for not clarifying earlier.

          Comment


            #6
            I am putting together an example and I will attach it here.

            Comment


              #7
              Looking forward to it. Thanks!

              Comment


                #8
                Hello trader3419,

                Thank you for your patience.

                So we still need OnRender() for one item, we need to get the scale of the chart from OnRender(). However, we don't have to do that on each click and therefore do not need to wait for an OnRender() pass for our mouse event.

                Attached is an example that shows how to use the MouseDownEventHandler to track when a mouse event occurs and print the Y value of the chart. It's important to note that we need the chart's scale from OnRender() to know where the Y is in relation to price.

                Please let me know if you have any questions.
                Attached Files

                Comment


                  #9
                  Attached is another that example that calls Scales to avoid OnRender altogether.

                  This is a great example of ensuring you do not call OnRender unless you are truly rendering an object.
                  Attached Files

                  Comment


                    #10
                    Wow! I am excited to dig into this once I get a chance today. Just from reading your posts, it seems like it is what I have been searching for! I will keep you posted with my results.

                    Thanks Patrick

                    Comment


                      #11
                      That was awesome. Thank you.
                      I don't have to use OnRender anymore and things are running much more smoothly.
                      Much appreciated Patrick!

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by algospoke, 04-17-2024, 06:40 PM
                      6 responses
                      48 views
                      0 likes
                      Last Post algospoke  
                      Started by arvidvanstaey, Today, 02:19 PM
                      4 responses
                      11 views
                      0 likes
                      Last Post arvidvanstaey  
                      Started by samish18, 04-17-2024, 08:57 AM
                      16 responses
                      61 views
                      0 likes
                      Last Post samish18  
                      Started by jordanq2, Today, 03:10 PM
                      2 responses
                      9 views
                      0 likes
                      Last Post jordanq2  
                      Started by traderqz, Today, 12:06 AM
                      10 responses
                      19 views
                      0 likes
                      Last Post traderqz  
                      Working...
                      X