Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ISSUE: ChartControl.ChartPanel.Invalidate();

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

    ISSUE: ChartControl.ChartPanel.Invalidate();

    I have an indicator which draws the order book directly on the price chart, instead of in a separate window. I find this to be much more convenient and useful than trying to use both a price chart and a separate DOM window.

    When I first implemented this indicator (I call it Radar) in NT7, one of the issues I had to overcome was the fact that, by default, an indicator's Plot() method is only ever called after a new tick event notification has been dispatched to the indicator (in other words, after OnBarUpdate() has been called.) That was a problem because the order book needs to be redisplayed after every change to the state of order book (in other words, after every level 2 market depth event has been dispatched to and processed by the indicator.) To solve the problem, I somehow discovered that I could evaluate ChartControl.ChartPanel.Invalidate(); in the body of the OnMarketDepth() method in order to force redisplay of the indicator after each level 2 event notification (it's an undocumented feature; I no longer remember how I discovered it.)

    The problem I now have is that, in NT8, ChartPanel does not have an Invalidate() method, although it does have an InvalidateVisual() method. But attempting to invoke ChartPanel.InvalidateVisual() results in an exception being raised involving thread ownership contention.

    I really need a way to have the indicator redraw itself whenever the state of the order book has changed. And more generally, indicators (and strategies, for that matter) should be able to request that they be redrawn whenever they've been notified of any event (level 1, level 2, fundamental data, position change, etc.)

    Having an invocable ChartPanel method for that purpose is one way to accomplish that, but it's not the only way, nor is it necessarily the best way. Another way would be to have a specific boolean property which controls whether or not the indicator (or strategy) will be redrawn following each specific type of event notification. And there are other approaches.

    But I really need some way to make Radar do in NT8 what it does quite well in NT7. Pretty please?

    Thanks!

    #2
    Using the indicator base ForceRefresh() will invalidate the chart control and queue the plot to be refreshed.
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by rocketman7, Today, 02:12 AM
    2 responses
    16 views
    0 likes
    Last Post rocketman7  
    Started by briansaul, Today, 05:31 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by PaulMohn, Today, 03:49 AM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_BrandonH  
    Started by frslvr, 04-11-2024, 07:26 AM
    6 responses
    106 views
    1 like
    Last Post NinjaTrader_BrandonH  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    6 responses
    26 views
    0 likes
    Last Post trilliantrader  
    Working...
    X