Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Thread problem

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

    Thread problem

    Is it normal that when I change the code and compile and reload my indicator I get the error message that I am trying to access an object that resides in another thread.

    If I close and reopen NinjaTrader then everything is normal again and I get no error message

    Thank you

    #2
    Originally posted by blar58 View Post
    Is it normal that when I change the code and compile and reload my indicator I get the error message that I am trying to access an object that resides in another thread.

    If I close and reopen NinjaTrader then everything is normal again and I get no error message

    Thank you
    I would not know off hand why the compile/reload causes issues but the subsequent restart does not present issues, but happy to figure help figure that out.

    The thread pool dispatcher is random, so you could run into situations where in one instance the object you're trying to access safely exists on the same thread, but in other scenarios, the object resides on another thread than the instrument thread.

    Here are some general guidelines:



    What object is throwing the threading exception? Are you checking thread access before trying to modify some property?

    In general, please also make sure you are calling .Freeze() on any custom brushes.
    MatthewNinjaTrader Product Management

    Comment


      #3
      Matthew ,

      I am using Xceed WPF PropertyGrid to modify properties on the fly.
      I created the PropertyGrid from the Dispatcher. Seems to be fine.

      The problem arises only when I start the indicator and when I have changed and recompile the code not when I am modifying properties with the PropertyGrid.

      Working hard to find out what is the cause of that problem

      Comment


        #4
        Which dispatcher are you using? The NinjaScriptBase (this.Dispachter)? The Instrument.Dispatcher? ChartControl.Dispatcher?

        What state are you trying to modify properties, or that you receive the exception?

        I do not have enough info for me to comment if that is normal or not. I would think not, but ultimately need to run the scenario by development with the thread access exception.
        MatthewNinjaTrader Product Management

        Comment


          #5
          It is a bug in Xceed propertygrid control, not NinjaTrader.
          It has been fixed in the paid version (Plus edition), but the free version has not yet been corrected.

          Comment


            #6
            Thank you very much cls71.

            Finally will stop searching for this problem from my code !

            Thanks !

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Brevo, Today, 01:45 AM
            0 responses
            3 views
            0 likes
            Last Post Brevo
            by Brevo
             
            Started by aussugardefender, Today, 01:07 AM
            0 responses
            3 views
            0 likes
            Last Post aussugardefender  
            Started by pvincent, 06-23-2022, 12:53 PM
            14 responses
            239 views
            0 likes
            Last Post Nyman
            by Nyman
             
            Started by TraderG23, 12-08-2023, 07:56 AM
            9 responses
            384 views
            1 like
            Last Post Gavini
            by Gavini
             
            Started by oviejo, Today, 12:28 AM
            0 responses
            6 views
            0 likes
            Last Post oviejo
            by oviejo
             
            Working...
            X