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 charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      68 views
      0 likes
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      151 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      162 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 05-10-2026, 08:12 PM
      0 responses
      100 views
      0 likes
      Last Post CarlTrading  
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      288 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Working...
      X