• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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:
    https://ninjatrader.com/support/foru...954#post410954

    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"
      https://ninjatrader.com/support/foru...ad.php?t=84087

      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.
          https://ninjatrader.com/support/help...t_overview.htm

          The AddOnFramework is definately another good starting point for me
          http://ninjatrader.com/support/helpG...ript_Basic.zip

          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 xsgex, Yesterday, 09:46 PM
          0 responses
          2 views
          0 likes
          Last Post xsgex
          by xsgex
           
          Started by Steve L, Yesterday, 09:36 PM
          0 responses
          1 view
          0 likes
          Last Post Steve L
          by Steve L
           
          Started by krugman25, Yesterday, 09:34 PM
          0 responses
          4 views
          0 likes
          Last Post krugman25  
          Started by indy73, Yesterday, 04:42 PM
          0 responses
          15 views
          0 likes
          Last Post indy73
          by indy73
           
          Started by Italianforex, Yesterday, 06:20 AM
          2 responses
          13 views
          0 likes
          Last Post gplatis
          by gplatis
           
          Working...
          X