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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      601 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      347 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      559 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X