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

A very strange thing with duplicate methods

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

    A very strange thing with duplicate methods

    Hello friends.

    I programmed an strategy that added and used an external indicator.
    If import it in other PC with Ninjatrader all its ok.
    Then i programmed other diferent strategy that calling the same indicator, and when i import it appears the alert "Duplicate methods names ....."

    I have 3 hours investigating... aggg

    One strange thing. The first strategy (with the added indicator) is imported in the PC correctly.
    After, if I import only the indicator appears the alert again but if i change the name of the indicator (only the name !), compile it and import it all its ok.... I think its ridiculous.

    I want to use this indicator in several strategies... Could you tell me how can i use it without errors?

    Thank you ! ; )

    #2
    Other strange thing its that the strategies works perfectly without this conflict in the Ninjatrader of hte computer where its being written. ...

    Comment


      #3
      Hello ninjo,

      Are you importing / exporting these strategies?

      Are you making protected dlls of these?

      When you make a protected export of a strategy this will include the indicator class within the export. If you make a second strategy and export this, this will also include that indicator. If you try and import both, both contain the indicator and this causes duplicate errors.

      So, you would want to export both strategies together, or make a custom export that does not include the indicator (requiring that the indicator always be installed before any strategies are installed). This would have to be done outside of NinjaTrader though.

      The best advice, would be in the second strategy, change the name of the indicator being called. Then there's no duplicates.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Thanks Chelsea B
        Yes, I am exporting protected dlls....

        Ok, i view that the solution is duplicate the indicators with other name... so much work every time I need to change something

        Some other ideas ??

        These are the dificult things of NT ...
        Last edited by ninjo; 08-31-2015, 12:44 PM.

        Comment


          #5
          Hi ninjo,

          You really only have the 3 options.

          1. Change the name of the indicator for each export.

          2. Create the dll and add to an export file outside of NinjaTrader that does not include the indicator.

          3. Export all strategies and indicators in one export.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Thank you !

            But, i dont understand the 2 and 3 options.

            Please could you develope it a little?

            Comment


              #7
              Hi ninjo,

              2. From visual studio you can export a custom dll. Then add this dll to .zip file with an AdditionalReferences.txt file referencing any added resources. This is not supported by NinjaTrader support to do (a.k.a. creating dlls outside of NinjaTrader), however, this is done by many developers that distribute custom code.

              Below is a link to the help guide.
              http://ninjatrader.com/support/helpG..._procedure.htm

              See the section 'Adding custom assemblies or native DLLs'.

              3. If you add both strategies to the same export and any indicators they reference, they will both reference the same indicator and should export and import without issue. (As long as the old strategies are removed first). In otherwords, don't create separate export files for each strategy, export them in the same export.
              Chelsea B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by rhyminkevin, Today, 04:58 PM
              4 responses
              52 views
              0 likes
              Last Post dp8282
              by dp8282
               
              Started by iceman2018, Today, 05:07 PM
              0 responses
              5 views
              0 likes
              Last Post iceman2018  
              Started by lightsun47, Today, 03:51 PM
              0 responses
              7 views
              0 likes
              Last Post lightsun47  
              Started by 00nevest, Today, 02:27 PM
              1 response
              14 views
              0 likes
              Last Post 00nevest  
              Started by futtrader, 04-21-2024, 01:50 AM
              4 responses
              50 views
              0 likes
              Last Post futtrader  
              Working...
              X