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

Import Failed

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

    Import Failed

    I've added a simple custom indicator to my strategy which runs ok and I can export & import my strategy ok but f I export a compiled assembly and then try to import it I get the

    i Click image for larger version

Name:	import.png
Views:	174
Size:	7.1 KB
ID:	1239809

    I've commented out all code and this is the cause:

    private myCustomIndicator myStrategyIndicator ... if I remove this, all is ok?

    I've also commented out all myCustomIndicator code inside the class and re-created it using a different name but it still persists




    #2
    myCustomIndicator compiled assembly imports ok on its own.
    Last edited by dibDab; 03-13-2023, 05:22 AM.

    Comment


      #3
      Originally posted by dibDab View Post
      myCustomIndicator compiled assembly imports ok on its own.
      same thing on StrategyPlotPanelSelectExample
      Attached Files

      Comment


        #4
        Hello dibDab,

        You cannot have two of the same class in C#.

        You will have to remove the original open source script, or exclude it from compilation.

        To remove a third party assembly package:To remove open source indicators:To remove an open source strategy:
        • Click New -> NinjaScript Editor -> select to expand the Strategies folder
        • Right-click the strategy by name -> select Remove
        To Exclude an open source script from compilation:
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          ok thanks, just to clarify:
          1. strategy/indicator compiles ok (no class name duplication).
          2. after removal of strategy/indicator source & strategy/indicator compiled assembly, I can import the strategy/indicator source (zip)
          3. after removal of strategy/indicator source & strategy/indicator compiled assembly, I cannot import the strategy/indicator compiled assembly (zip)?
          4. if I remove indicator reference from the strategy, I can import the strategy compiled assembly (zip)?
          5. I can import the indicator compiled assembly?
          not sure if this makes sense?​

          as shown with StrategyPlotPanelSelectExample (above)
          Last edited by dibDab; 03-13-2023, 11:33 AM.

          Comment


            #6
            Hello dibDab,

            You cannot have both the open source and the compiled assembly at the same time.

            Yes, if you remove the open source scripts, then you can import the compiled assembly.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              but that's my point, I can't import the compiled assembly, as shown in your StrategyPlotPanelSelectExample

              after removal of strategy/indicator source & strategy/indicator compiled assembly, I can import the strategy/indicator source (zip)

              then

              after removal of strategy/indicator source & strategy/indicator compiled assembly, I cannot import the strategy/indicator compiled assembly (zip)?

              Comment


                #8
                Hello dibDab,

                If you have removed the assembly and you are trying to re-import it and cannot, likely something wasn't fully removed. Check the Tools -> Remove NinjaScript Assembly window for any assemblies that have any classes that are in this assembly.
                Chelsea B.NinjaTrader Customer Service

                Comment


                  #9
                  ok but

                  after removal of strategy/indicator source & strategy/indicator compiled assembly (Remove all Ninjascript Assemblies), I can import the strategy/indicator source (zip)

                  then

                  after removal of strategy/indicator source & strategy/indicator compiled assembly (Remove all Ninjascript Assemblies​), I cannot import the strategy/indicator compiled assembly (zip)?​

                  can be demonstrated using your StrategyPlotPanelSelectExample (above).

                  both strategy and indicator compile ok.
                  Last edited by dibDab; 03-13-2023, 12:46 PM.

                  Comment


                    #10
                    Hello dibDab,

                    If you cannot import the assembly due to duplicate class names, this means there is already a script in NinjaTrader using a class name in the assembly. Remove it (or exclude it if open source) first.

                    This can be demonstrated with any script. Doesn't matter if its StrategyPlotPanelSelectExample or one you have created.
                    Chelsea B.NinjaTrader Customer Service

                    Comment


                      #11
                      ok thanks for help but I don't think strategies compile if they're duplicated, both my strategy/indicator compile and your StrategyPlotPanelSelectExample

                      I'm sure you're right just trying to make it work, will go figure
                      Last edited by dibDab; 03-13-2023, 01:23 PM.

                      Comment


                        #12
                        Originally posted by dibDab View Post
                        ok thanks for help but I don't think strategies compile if they're duplicated, both my strategy/indicator compile and your StrategyPlotPanelSelectExample
                        No, you cannot simply copy a strategy file to a new name and compile it without changing its class name to a new, unique class name and then fixing any other references to that old name in the new file.

                        Most people load up the old one in Script Editor if they're using the inbuilt editor, and right-click, Save As and give it a new name, which automatically changes the class name for you (and some of the references also). For a simple one, that's probably enough to get it to compile.
                        Bruce DeVault
                        QuantKey Trading Vendor Services
                        NinjaTrader Ecosystem Vendor - QuantKey

                        Comment


                          #13
                          Hello dibDab,

                          If both scripts are compiling, then the class names are different and are not being duplicated.

                          However, that does not appear to be related to your inquiry in post # 9 about removing an assembly and then re-importing the same assembly you just removed.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            all ok, thanks for help

                            Comment


                              #15

                              what may have been my cause of confusion is I'm trying to import 2 strategies (dll's) both using the same indicator?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by burtoninlondon, Today, 12:38 AM
                              0 responses
                              10 views
                              0 likes
                              Last Post burtoninlondon  
                              Started by AaronKoRn, Yesterday, 09:49 PM
                              0 responses
                              14 views
                              0 likes
                              Last Post AaronKoRn  
                              Started by carnitron, Yesterday, 08:42 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post carnitron  
                              Started by strategist007, Yesterday, 07:51 PM
                              0 responses
                              14 views
                              0 likes
                              Last Post strategist007  
                              Started by StockTrader88, 03-06-2021, 08:58 AM
                              44 responses
                              3,983 views
                              3 likes
                              Last Post jhudas88  
                              Working...
                              X