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

FileOpen dialog on indicator

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

    #16
    Originally posted by andrius View Post
    Dear Buddy,

    you need to add referrence to System.Design.dll file for this to complile. Depending on IDE you use this may vary... On Ninja editor just press right click and follow from there.

    -Andrius.
    That there is the problem if one tries to distribute the indicator. Are we then to instruct the user how to add a reference? I have not seen any "Help" topic on how to add a new reference, when one adds an indicator, without using the right-click configuration dialog box. Suggesting that we write installation code to directly edit Config.xml, will cause a heart attack in the NT developers, so we do not even need to go there.

    Comment


      #17
      Is this a bug then?

      Here is the skinny after a whole host of experimentation that I just did on this one.

      Here is how it works out.
      1. Use right-click in the indicator editor to add a reference. It will be added with the fully qualified path name. Not nice.
      2. Compile the indicator.
      3. Export the indicator as a DLL (VERY VERY IMPORTANT!!)
      4. If the DLL is imported, it will automatically add the reference to the System.Design.dll, without any path information. In other words, the correct way!

      You can test this by removing the reference and renaming the file after you export the indicator. Restart NinjaTrader and verify that the reference is gone (the restart is not really required, but let us make assurance double sure). We are testing what would happen if your customer did NOT have the reference loaded, and tried to import the indicator that you just sold to her.

      Import the DLL indicator, and you will find that NT tells you that you need the reference, and then creates the reference for you automatically. You can verify this by opening any indicator for editing and looking at the references using the right-click menu.

      The nice thing is that if you then remove the assembly using the approved NT method, the reference to System.Design.dll stays in the references! How nice?

      Here is the problem/potential bug.

      If you do the same thing, except that you export the indicator, as source, rather than as a dll, when you try to import the indicator, NT returns an error: "Import failed. The NinjaScript archive may contain dupliacte method names that already exist on your PC or there is a required file missing in either your PC or in the import archive." I repeat: this is on a clean system. To verify, I uninstalled NT, and reinstalled it, then tried to import the source version, and got the same error.

      I have attached 2 reference files for use in duplicating the problem. I consider it a bug related to importing indicators that need a system reference that NT does not ship with by default. IMHO, it should work for imports the same way, whether the exported indicator is exported as an assembly or as source code.

      Of course, if we are not supposed to use any methods from System DLLs tthat NT does not reference out of the box, this point is moot, and this whole thread should probably be moved to the thread for unsupported tips and tricks.
      Attached Files

      Comment


        #18
        Bug in Assembly references handling. NT Support. I think that this issue deserves a response. Can we have one please?

        Comment


          #19
          koganam, sorry for the late follow up - this is working as expected, this unfortunately how reference dll are handling in compiled assemblies, this is exactly the reason why assemblies for distribution should only be exported from a clean system without any custom references defined / set.
          BertrandNinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_Bertrand View Post
            koganam, sorry for the late follow up - this is working as expected, this unfortunately how reference dll are handling in compiled assemblies, this is exactly the reason why assemblies for distribution should only be exported from a clean system without any custom references defined / set.
            Sorry Bertrand, I do not quite understand. I have quoted the relevant part here, but you may want to reread the whole post.(New emphasis mine, in red. Not shouting; just making it prominent)

            Here is the problem/potential bug.

            If you do the same thing, except that you export the indicator, as source, rather than as a dll, when you try to import the indicator, NT returns an error: "Import failed. The NinjaScript archive may contain duplicate method names that already exist on your PC or there is a required file missing in either your PC or in the import archive." I repeat: this is on a clean system. To verify, I uninstalled NT, and reinstalled it, then tried to import the source version, and got the same error.
            IOW, an export as a dll works differently from an export as a .cs file: the dll export/import has no problem, but the source export/import does. The inconsistency is what strikes me as a bug.

            Comment


              #21
              so I am not alone fighting with NT support for reference problem. They try to convince me that this is expected behaviour, but I still resist My last email was about two days ago or so.

              Funny thing happens if you have say proprietary indicator and vanilla system. Then you create your simple indicator, that doesn't require any external references. If you choose to export it Info.xml is added with reference to that proprietary indicator. This is clearly a bug.

              In any case it's possible to find out which libraries some code requires and there should be added only those references. Looks like they search references in the same folder all indies lurk. What about simply copying needed indie and all referenced indies by that indie to tmpdir and only then wrap everything up in .zip? This is only one of possible ways to fix this. Of course there are more clever scenarios like http://stackoverflow.com/questions/4...l-dependencies, google "list dll dependencies".

              Comment


                #22
                A related post, fyi

                whitmark
                NinjaTrader Ecosystem Vendor - Whitmark Development

                Comment


                  #23
                  Originally posted by koganam View Post
                  Sorry Bertrand, I do not quite understand. I have quoted the relevant part here, but you may want to reread the whole post.(New emphasis mine, in red. Not shouting; just making it prominent)

                  IOW, an export as a dll works differently from an export as a .cs file: the dll export/import has no problem, but the source export/import does. The inconsistency is what strikes me as a bug.
                  Thanks koganam, so you're basically saying :

                  a) for the source import : the dll has to be manually added before import

                  b) for the compiled import : the dll would be added automatically

                  Is that the issue you ran into?

                  Thanks,
                  BertrandNinjaTrader Customer Service

                  Comment


                    #24
                    Originally posted by NinjaTrader_Bertrand View Post
                    Thanks koganam, so you're basically saying :

                    a) for the source import : the dll has to be manually added before import

                    b) for the compiled import : the dll would be added automatically

                    Is that the issue you ran into?

                    Thanks,
                    When I found the problem, I just noted and reported it on the forum. As I actually supply code in the form of DLL to clients, and never source, it was not really a big issue at the time, and I was on a deadline, so I just kept going.

                    However, as I never had the problem with my own source code, which I never had to import, except when I tried the test on a virgin installation, I would have to surmise that manually adding the reference would probably alleviate the problem.

                    As I know you folks are busy, and I just rebuilt another virgin development environment, let me test that theory out and report.

                    Comment


                      #25
                      Hi Guys,

                      just wondering if anyone had solved this riddle yet.

                      I have found this dll that could help with the viewing of files but am unsure if its the correct thing I should be doing any pointers appreciated.
                      A very simple class to include the browse for folder window into your C# project



                      Thanks Raef

                      Comment


                        #26
                        I also found this but my brain is drowning with information overload

                        //public static string Sellalert

                        /*{
                        string fileName = @"C:\mydir\myfile.ext";
                        string path = @"C:\mydir\";
                        string result;
                        result = Path.GetFileName(fileName);
                        Console.WriteLine("GetFileName('{0}') returns '{1}'", fileName, result);
                        result = Path.GetFileName(path);
                        Console.WriteLine("GetFileName('{0}') returns '{1}'",
                        path, result);
                        }
                        */
                        Last edited by raefon72; 03-31-2012, 11:45 PM.

                        Comment


                          #27
                          Originally posted by raefon72 View Post
                          Hi Guys,

                          just wondering if anyone had solved this riddle yet.

                          I have found this dll that could help with the viewing of files but am unsure if its the correct thing I should be doing any pointers appreciated.
                          A very simple class to include the browse for folder window into your C# project



                          Thanks Raef
                          What riddle? The code for opening a selection dialog box from the indicator properties page is right in this thread. Try reading it from the top. I believe post #5 is where the actual code is posted.

                          Comment


                            #28
                            I am getting lost / confused with the editor. I right click add refference but the dll is not there when I add it takes me to the NT7 folder but no dll for System.Design.dll is it another dll that I am refrencing / adding.??
                            Thanks
                            raef

                            Comment


                              #29
                              Originally posted by raefon72 View Post
                              I am getting lost / confused with the editor. I right click add refference but the dll is not there when I add it takes me to the NT7 folder but no dll for System.Design.dll is it another dll that I am refrencing / adding.??
                              Thanks
                              raef
                              System.Design.dll is a System dll. It will be in the folder where .NET is installed. Mine happen to be as shown in the picture. Best reference is probably the last one.
                              Attached Files

                              Comment


                                #30
                                cool I found mine at

                                C:\Windows\Microsoft.NET\Framework\v2.0.50727

                                one hurdel covered thanks

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by usazencort, Today, 01:16 AM
                                0 responses
                                1 view
                                0 likes
                                Last Post usazencort  
                                Started by kaywai, 09-01-2023, 08:44 PM
                                5 responses
                                603 views
                                0 likes
                                Last Post NinjaTrader_Jason  
                                Started by xiinteractive, 04-09-2024, 08:08 AM
                                6 responses
                                22 views
                                0 likes
                                Last Post xiinteractive  
                                Started by Pattontje, Yesterday, 02:10 PM
                                2 responses
                                21 views
                                0 likes
                                Last Post Pattontje  
                                Started by flybuzz, 04-21-2024, 04:07 PM
                                17 responses
                                230 views
                                0 likes
                                Last Post TradingLoss  
                                Working...
                                X