• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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:
    http://ninjatrader.com/support/helpG...htsub=onrender
    http://ninjatrader.com/support/helpG...htsub=onrender

    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:
    http://ninjatrader.com/support/helpG...otindexbyx.htm

    For the X conversions, ChartPanel would be used:
    http://ninjatrader.com/support/helpG...chartpanel.htm

    For Y the ChartScale would be used:
    http://ninjatrader.com/support/helpG...chartscale.htm

    Here is an example of an X value from Bar index conversion:
    http://ninjatrader.com/support/helpG...ightsub=getxby

    I look forward to being of further assistance.
    Last edited by NinjaTrader_Jesse; 01-27-2016, 12: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 gemini42, Yesterday, 09:44 PM
      0 responses
      5 views
      0 likes
      Last Post gemini42  
      Started by martyn73, Yesterday, 03:09 PM
      0 responses
      2 views
      0 likes
      Last Post martyn73  
      Started by martyn73, Yesterday, 03:05 PM
      0 responses
      4 views
      0 likes
      Last Post martyn73  
      Started by mic414, Yesterday, 02:17 PM
      0 responses
      1 view
      0 likes
      Last Post mic414
      by mic414
       
      Started by U0000999, 11-15-2019, 06:18 PM
      1 response
      22 views
      0 likes
      Last Post NinjaTrader_ChrisL  
      Working...
      X