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

Unable to create instance - with all my indicators, including non opened ones

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

    Unable to create instance - with all my indicators, including non opened ones

    I'v developed several Indicators. I am getting "Unable to create instance" error messages on my long, and NT crash from time to time.

    I've looked at the forum and found few cases, for all of them the solution was the problem disappear. I followed the advices in one: http://www.ninjatrader.com/support/f...ad.php?t=28971 and I have done following steps to repair:
    • I closed all my workspaces, but a default one with nothing on it
    • repair db
    • close NT
    • remove all files in directory NinjaTrader 6.5\cache
    • remove all files in directory NinjaTrader 6.5\bin\Custom\tmp
    • start NT
    • Opened a new workspace with a clean chart
    • load one of my indicator and build


    After less than a minute my log filled with "Unable to create instance" error to all of my indicators, which are not even opened or used.

    Attached is the log and a this simple indicator file.
    Attached Files

    #2
    Thanks for the post Shai, if you check on the setup now - would all studies including potential reference compile properly as you would expect? Initialize would be called across indicator scripts, so you would see issues there for all if you just attempted to test a single one for example, so that's expected.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Sorry Bertrand, but this time I didn't really get you. Can you please try and explain again what you mean?

      Can you get a quick look at my example Indicator code and tell me, if there is anything basicly wrong with it, that should cause this kind of error?
      "Unable to create instance of '...'. Most likely there is no default constructor defined, or the default constructor does not work correctly: Constructor on type 'NinjaTrader.Indicator.bdtTrandLines+Trend' not found.
      Attached Files

      Comment


        #4
        Sure, the indicator would not be the cuplrit, it compiles well here for me. If you compile all studies in your NS editor, do you see any errors thrown then? Were you using / removing any 3rd party addons lately that would be depending on their own dll file in the bin > custom folder of NT?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          All my code compiles with no error. Yes, I am using a 3rd party educational indicators, which required DLLs and that the lic, would be their 3rd Party Lic. Could this be the cause of the problem?

          Comment


            #6
            Thanks, yes that would be an area to investigate. I would uninstall all custom dlls / addons for now and then see if the issue would still persist afterwards. If it does please let me know via emailing via Help > Mail to Support.

            If the issue would not persist, please reinstall those addons one by one to see if a particular one causes it.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I have seen this error messages over several posts without a good solution. I succeeded to get to the bottom of it, and solve it, and here is my small contribution to this wonderful community and support team.

              I discovered, I get these messages when I open the Indicator list in the Chart window, and these messages are of any custom class I created in any of my indicators. These custom classes are constructed in the OnStartUp().

              Reading into the error messages:
              Unable to create instance of 'NinjaTrader.Indicator.MyIndicator+MyClass'. Most likely there is no default constructor defined, or the default constructor does not work correctly: Constructor on type 'NinjaTrader.Indicator.MyIndicator+MyClass' not found.
              I learned that the source of these messages is simply as the message suggested: I need to add a default constructor to each of my class.

              Its just a simple line like

              Code:
              public MyClass(): base() {}
              for each of my classes, on top of the real constructor as shown here

              Code:
              public MyClass(): base() {}[
              public MyClass(Indicator parent, string name)
              {
                 this.parent = parent;
                 this.name = name;
              }
              The error is gone and performances are better.

              Comment


                #8
                Shai's response worked for me also. Thanks!

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Perr0Grande, Today, 08:16 PM
                0 responses
                2 views
                0 likes
                Last Post Perr0Grande  
                Started by elderan, Today, 08:03 PM
                0 responses
                4 views
                0 likes
                Last Post elderan
                by elderan
                 
                Started by algospoke, Today, 06:40 PM
                0 responses
                10 views
                0 likes
                Last Post algospoke  
                Started by maybeimnotrader, Today, 05:46 PM
                0 responses
                9 views
                0 likes
                Last Post maybeimnotrader  
                Started by quantismo, Today, 05:13 PM
                0 responses
                7 views
                0 likes
                Last Post quantismo  
                Working...
                X