Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

A pile of OnRender questions

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

    A pile of OnRender questions

    Hi,
    1. Is OnRender the place to go for writing text and graphics (lines, etc), on a chart? Using the draw objects seems heavy handed compared to SharpDX.
    2. When is OnRender invoked and what triggers it?
    3. Can I invoke it?
    4. I want to essentially have a Bar.MouseClick event to enable me to invoke OnRender when the user clicks on a bar so I can do my rendering. Does something like this exist? If not, can I get there?
    5. Assuming there is a way to catch a mouse click and convert it's coordinates to a bar (or null if it's not on a bar), can I invoke OnRender directly? If so, how do I get the parameters to pass to it?
    6. If I can't invoke OnRender directly, then when it does get called, how can I convert ChartPanel.X and ChartPanel.Y to a Bar?
    7. Conversely, how can I convert a given bar to ChartPanel X and Y?

    Two snicker's bars to anyone that can help get me off the dime!
    Thanks ... Ed

    #2
    Hello,

    Thank you for the questions.

    OnRender would be used if you want to draw custom objects or drawings that are not associated with a DrawingObject. The OnRender is simply an outlet to render anything you want using sharpDX opposed to using the pre configured items like Drawing Objects.

    OnRender would be invoked internally and is event driven, depending on which OnRender you are referring the events that trigger this are different. For example see the SuperdomColumn OnRender opposed to the ChartStyle:



    OnRender is an Override meaning that you can not invoke it as you are basically just listening to this internal method from your script, this is the same concept as OnBarUpdate only being driven by bar updates. Instead if you need to force a refresh you could call ForceRefresh: http://ninjatrader.com/support/helpG...orce%2Brefresh

    Regarding your on click event, I am unsure if this would or would not be possible regarding the refresh portion. You may be able to invoke the ForceRefresh event from the mouse handler but this does only queue a forced refresh and may not immediately update so there still may be delay in actions when using this approach.

    Regarding your questions on converting values, there are already in place method for converting a Bars id or times to an X value and prices to Y, also for the reverse.

    For X to Slots you could use:


    For the X conversions, ChartPanel would be used:


    For Y the ChartScale would be used:


    Here is an example of an X value from Bar index conversion:


    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 01-27-2016, 01:55 PM.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Looks like I have a pile of reading to do. Thank you very much for taking the time to give me such a detailed answer. I'll go do my homework now!
      Thanks again ... Ed

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by trilliantrader, 04-18-2024, 08:16 AM
      4 responses
      18 views
      0 likes
      Last Post trilliantrader  
      Started by mgco4you, Today, 09:46 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by wzgy0920, Today, 09:53 PM
      0 responses
      10 views
      0 likes
      Last Post wzgy0920  
      Started by Rapine Heihei, Today, 08:19 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 08:25 PM
      0 responses
      10 views
      0 likes
      Last Post Rapine Heihei  
      Working...
      X