Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Set plot value from different thread

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

    Set plot value from different thread

    I am trying to set PLOT value from Button click.
    In "OnButtonClicked" i use:

    Code:
    ChartControl.Dispatcher.InvokeAsync(() =>
    {
        // i.e. 5 bars ago from last bar
       Print("start");
        Values[0][5] =123;
       Print("end");
    });
    However, it is not able to set the value. Instead i get the "Start", but dont get "end" in the output logs.
    I probably something stops the whole execution while I try to set plot value from there... any help?

    #2
    Hello TazoTodua,

    Are you getting an indexing error?
    (You will need a try and catch and print the exception to find out)

    Is there a reason you are invoking into the ChartControl thread? (I don't think you need to be invoking into the UI thread, but if you do, always use InvokeAsync to prevent locking)

    If this from a button click event, this would be outside of a data driven method. Is this code within TriggerCustomEvent() to synchronize series?
    https://ninjatrader.com/support/help...ustomevent.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thanks your examples helped. I don't know what is magic behind TriggerCustomEvent, but it solved problem.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      81 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      41 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      64 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      66 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      54 views
      0 likes
      Last Post CarlTrading  
      Working...
      X