Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

SampleAddOn.zip - Unhandled exception

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

    SampleAddOn.zip - Unhandled exception

    I have imported an Add on to NinjaTrader 8 v8.0.10.0 64bit.
    Datafeed: NinjaTrader Continuum demo & Playback data

    The original post and SampleAddOn.zip file are at:


    When i run the add on, the window loads with empty labels, but selecting a symbol from the dropdown causes this error:

    Code:
    2017-12-04 08:29:11:264|3|4|Error in realtime market data handling: System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.    at System.Windows.Threading.Dispatcher.VerifyAccess()    at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)    at NinjaTrader.Custom.AddOns.SampleAddonWindowTabPage.marketData_Update(Object sender, MarketDataEventArgs e)    at NinjaTrader.Data.MarketData.OnMarketData(Object sender, MarketDataEventArgs e)    at NinjaTrader.Cbi.Instrument.<>c__DisplayClass143_0.<OnRealtimeDataTimerElapsed>b__1(SubscribedThread[] threads, Int32 i, RealtimeEvents evts)
    2017-12-04 08:39:35:822|0|4|Unhandled exception: The calling thread cannot access this object because a different thread owns it.
    I am sure i have successfully run this code in a previous version of NT8.

    Please can NT Support confirm that they can install and run SampleAddOn?
    Your comments are appreciated.

    #2
    Hello,

    Thank you for the post.

    This sample was provided pretty early in the beta and is no longer relevant, quite a few items in the beta section will now fall into this category. You would likely need to debug that sample to locate the problem, but I would instead suggest to just review the Addon development help pages as there are a few complete samples there: https://ninjatrader.com/support/help...t_overview.htm

    The Addon basic sample is a newer rendition of the item you have linked that shows all the NinjaScript specific GUI items and how they work.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Jesse, Many thanks for clarifying that. After reading some previous forum posts, I had suspected that some "Invoke" (or other) keywords had been changed since the beta;

      Anyway, after successfully installing and running the AddOn Demo by Davel at
      "New Example AddOn Demonstrates a Wide Range of Functionality"


      I am now happy in the knowledge that the SampleAddOn script had become outdated; and Davels demo should assist me in understanding where it is failing.

      Ideally, I would like to Fix SampleAddOn, which should improve my understanding of programming AddOn functionality.

      Thanks for your prompt assistance today.

      Comment


        #4
        Hello,

        Thank you for the reply.

        Based on the error you posted, this is likely that a dispatcher is not being used in some case. Because this sample is from 2015, I really couldn't suggest using it as there is a specific sample that has taken its place.

        The newer sample shows the correct dispatcher use along with more of the supported controls and their syntax. Because the item you linked is a beta sample it is lacking the improvements and considerations the newer versions use. In this case, I wouldn't really suggest spending time on trying to fix it. The items in the beta forum often can be used for learning and reference, but in this case, I would advise the opposite and suggest the final sample we provide in the help guide now for learning purposes.

        If you really want to see what has changed, you could put the old sample into the same structure as the new sample and then run a DIFF between the two files. That way you could catch any changes between the two, but again the older file does not have the considerations that we advise now so I really couldn't suggest using it.



        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Jesse,

          You're right. I agree, trying to fix an outdated script is not a good place for me to start. I will focus on the latest Add On demos that you have linked to in the Educational Resources.


          The AddOnFramework is definately another good starting point for me


          Although it is titled "Basic" it has extensive functionality (1966 lines of code) that works right out of the box. This will be just the job to assist in me understanding Add Ons.

          Thanks again for your comments.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by nandhumca, Yesterday, 03:41 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by The_Sec, Yesterday, 03:37 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by vecnopus, Today, 06:15 AM
          0 responses
          1 view
          0 likes
          Last Post vecnopus  
          Started by Aviram Y, Today, 05:29 AM
          0 responses
          5 views
          0 likes
          Last Post Aviram Y  
          Started by quantismo, 04-17-2024, 05:13 PM
          3 responses
          27 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X