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 Shansen, 08-30-2019, 10:18 PM
            24 responses
            938 views
            0 likes
            Last Post spwizard  
            Started by Max238, Today, 01:28 AM
            0 responses
            3 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by rocketman7, Today, 01:00 AM
            0 responses
            2 views
            0 likes
            Last Post rocketman7  
            Started by wzgy0920, 04-20-2024, 06:09 PM
            2 responses
            27 views
            0 likes
            Last Post wzgy0920  
            Started by wzgy0920, 02-22-2024, 01:11 AM
            5 responses
            32 views
            0 likes
            Last Post wzgy0920  
            Working...
            X