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

exporting and importing issues with dupliate method names

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

    exporting and importing issues with dupliate method names

    I have a custom indicator
    It is used in a strategy

    I export the strategy - it asks if i want to include the custom indicator and other system inicators - i have to click yes to proceed.

    I upload and import to a new instance of NinjTrader 6.5
    The strategy is imported.

    I export all My Custom Indicators as a Pack from NT -
    upload and import... It cannot import as error message popup there are duplicate methods erro... script import failed....
    Last edited by MicroTrends; 12-29-2009, 12:00 AM.
    MicroTrends
    NinjaTrader Ecosystem Vendor - micro-trends.co.uk

    #2
    I tried to control this by using 3 files:
    #1 indicators only
    #2 strategies + dependencies from #1
    #3 bothcombined

    The trouble happens when importing #3 -

    This seems to be isolated to one machine only:

    Import failed. the Existing Ninjascript file c:\documents and settings\administrator\my documents\ninjaTrader 6.5\MicroTrendsStratPackIndicatorPack.dll" contains duplicate method names
    found in the imported NinjaScript Archive file....

    Perhaps I will resintall that version and check it is up to date etc...
    Last edited by MicroTrends; 12-29-2009, 12:25 AM.
    MicroTrends
    NinjaTrader Ecosystem Vendor - micro-trends.co.uk

    Comment


      #3
      Please try importing the assembly in a new install where the 'exported' from cs files / method names are not present also in the install.

      You can also drop the Dll in the custom folder and then compile all, this would give you hints which methods are in conflict.
      BertrandNinjaTrader Customer Service

      Comment


        #4
        Also experiencing this Import / Export problem

        Hi,
        I have also experienced the same problem presented by MicroTrends. I have read in other posts to try a new install and many times this corrects the problem for the time being. My question is what causes this frustrating issue? Can anyone point me in a direction where I can read more on the causes of this issue? I have been writing custom indicators for members of a trading group and have spent an enormous amount of time trying to reconcile this problem.

        Any help would be greatly appreciated.
        Thanks

        Comment


          #5
          I solved the issue by using 3 files -
          1 for indicators only
          2 for strategies only
          3 for both of them

          I'm not saying it is correct but that is the way the journey took me.at 6.30am..

          To stop the error repeating on some machines and not others i went to my docs..../NinjaTrader 6.5 and removed all files that were left there from previosu failed attempts or failed removals... then #3 worked...

          The trouble seemed to stem from the fact that the strategy referenced a custom indicator so i was unable to install the rest of the indicators later as there was a clash - it all got very messy...
          Last edited by MicroTrends; 12-29-2009, 02:03 PM.
          MicroTrends
          NinjaTrader Ecosystem Vendor - micro-trends.co.uk

          Comment


            #6
            MicroTrends,

            Thanks for your help. The only way I resolved the problem was to re-install ninja. Now that have a fresh install I'll re-try your methods going forward.

            Comment


              #7
              I go this error and I'm only exporting an indicator. What's weird is I looked at the dll exported and there is a bunch of stuff in there that I don't use in my indicator, I'm talking about other indicators or strategies that I wrote. I don't know why they're getting into there but maybe that is the cause of my problem?

              I'm thinking I need a new NT install and then I put my source on it and then export the assembly from that. It's a pain to have a pc with virgin ninja just for exporting.

              any other ideas?

              Comment


                #8
                Hi

                My errors I found revolved around custom enums exposed as public properties.
                They needed to be kept in the top level namespace NinjaTrader. so they are accessible by:
                NinjaTrader.Strategy
                NinjaTrader.Indicator
                NinjaTrader.Analyzer
                etc
                MicroTrends
                NinjaTrader Ecosystem Vendor - micro-trends.co.uk

                Comment


                  #9
                  how did you troubleshoot this? I copied my DLL into my indicator directory and added it as a reference and everything still compiles.

                  Comment


                    #10
                    My understanding is If you have a 3rd party dll - it normally needs to be added as a reference by right clicking in the NinjaScript editor. Then it will need distributing to the target machine in the path set in the reference.

                    My issue revolved around namespaces - so in the end i simply refactored, compiled and exported 1 dll via the NinjaScript Export utility.

                    I created an indicator and changed the default code so all it contained was a namespace and the enums. NinjaScript generated code can then reference it. I saved the file as MicroTrends.Enums
                    When exporting I included this as a custom Indicator to export - so it gets included with the complied dll.
                    I also built a framework of other classes to assist development such as a core library and common methods - I can then reference these from the Indicators and Strategies. These are exported alongside any indicator or strategy that uses them.

                    They all appear within the NinjaScript Editor - it simply enumerates cs files in the indicator/strategy folders in bin\custom.

                    Sample of Enum code:

                    MicroTrends.Indicator.Enums.cs

                    namespace NinjaTrader
                    {
                    public enum indicatorStates
                    {
                    unknown = 0,
                    Flat = 1,
                    Rising = 2,
                    Falling = 3
                    }
                    }

                    Common Code file example used for controlling settings persistance and retrieval (pre NT7)

                    #region Using declarations
                    using System;
                    using System.ComponentModel;
                    using System.Diagnostics;
                    using System.IO;
                    using System.Reflection;
                    using System.Configuration;
                    using System.Xml.Serialization;
                    using System.Data;
                    using System.Collections;
                    using MicroTrends.Forms;

                    #endregion

                    namespace MicroTrends.Config
                    {
                    #region enums
                    public enum categoryAttribute
                    {
                    General,
                    Parameters
                    }
                    #endregion

                    /// <summary>
                    /// Version 7.0.0.1 - MicroTrends.Config.Settings class manages module public parameter and general property settings
                    /// </summary>
                    public class Settings
                    {
                    #region Variables
                    private string dataSetXMLDir = @"C:\MicroTrends\settings";
                    private string dataSetXMLFile = "settingsDS1.0.xml";
                    private DataSet settingsDataSet = null;
                    private Object objectIt = null;
                    private string moduleName = string.Empty;
                    #endregion

                    #region Constructor
                    public Settings(string moduleName, Object objModule)
                    {
                    this.objectIt = objModule;
                    this.moduleName = moduleName;
                    this.dataSetXMLFile = moduleName + ".xml";
                    }
                    #endregion

                    #region Methods
                    private PropertyInfo[] getProperties(Type type, string categoryAttributeNameFilter)
                    {
                    ArrayList al = new ArrayList();
                    PropertyInfo[] propertyInfo = type.GetProperties();

                    foreach (PropertyInfo p in propertyInfo)
                    {
                    //foreach (Attribute attribute in p.GetCustomAttributes(false))
                    if (p.PropertyType.BaseType == typeof(System.ValueType))
                    {
                    foreach (Attribute attribute in p.GetCustomAttributes(typeof(System.ComponentModel .CategoryAttribute), false))
                    {
                    if (!string.IsNullOrEmpty(categoryAttributeNameFilter ))
                    {
                    System.ComponentModel.CategoryAttribute ca = (System.ComponentModel.CategoryAttribute)attribute ;
                    if (ca.Category.Replace(" ", "").ToLower() == categoryAttributeNameFilter.ToLower())
                    {
                    al.Add(p);
                    }
                    }
                    else
                    {
                    al.Add(p);
                    }
                    }
                    }
                    }

                    PropertyInfo[] result = (PropertyInfo[])al.ToArray(typeof(PropertyInfo));
                    return result;

                    }
                    ///code cut out for brevity........

                    }

                    So this means i can build and reference/ inherit from a library of classes from any indicator or strategy etc... All i do is select the relevant class file when exporting and it works fantastically....:-)













                    There were dependencies on the
                    MicroTrends
                    NinjaTrader Ecosystem Vendor - micro-trends.co.uk

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by CortexZenUSA, Today, 12:53 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post CortexZenUSA  
                    Started by CortexZenUSA, Today, 12:46 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post CortexZenUSA  
                    Started by usazencortex, Today, 12:43 AM
                    0 responses
                    5 views
                    0 likes
                    Last Post usazencortex  
                    Started by sidlercom80, 10-28-2023, 08:49 AM
                    168 responses
                    2,265 views
                    0 likes
                    Last Post sidlercom80  
                    Started by Barry Milan, Yesterday, 10:35 PM
                    3 responses
                    12 views
                    0 likes
                    Last Post NinjaTrader_Manfred  
                    Working...
                    X