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

Xml Error when opening NTWindow

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

    Xml Error when opening NTWindow

    I'm creating an addon to run in the background of NT8. I have attached the code for the Add On. When I click the MenuItem to display my custom NTWindow, I am receiving the following error:

    Code:
    System.Xml.XmlException: The '+' character, hexadecimal value 0x2B, cannot be included in a name.
    This only happens every other time I try to open the NTWindow. Every other time it will open and so far it seems to work as expected. Is there an error in my code?
    Attached Files
    Last edited by toptrader; 11-21-2016, 01:54 PM.

    #2
    Hello toptrader, and thank you for your question.

    I noticed your strategy contains characters outside the ASCII range between lines 177 and 181, and between lines 231 and 241, which are not part of your strategy logic. I am returning a copy of your strategy with these characters removed. This should resolve your query.

    Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your reply. I do not see any differences in your code and my original code. I copy and pasted the code from your sample in my Add On, but I am still receiving the same error.

      Comment


        #4
        The differences are likely being caused by your code editor, and this may also be why characters outside the 0x00 - 0x7F range are invisible to you. I would like to recommend reviewing your code with an editor such as the freely and publicly available Notepad++, available here,



        Once you have an editor which will reveal unprintable characters, please review your code around the lines I mentioned previously.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          I downloaded Notepad++, but I am still not seeing any extra characters.



          Attached Files

          Comment


            #6
            The editor I typically use, gvim when I am on windows, reveals the attached image. The left image is your original code, the right image is the modified code that I returned to you. For your benefit, I am also attaching hex dumps of both files to this reply. There are interesting characters around byte 0x1800.

            Please ensure that you are loading the file you originally attached to your first reply into Notepad++ should you test in Notepad++, and not any files you have modified or copy / pasted into. It is important to do so, because it may be the case that your compiler or editor is adding garbage characters.

            Have you had the same results when you use the code I sent you directly, rather than copying and pasting in?
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              OK. I have completely removed the lines of code where you are seeing extra characters, but I am still seeing the issue. I have attached the latest code I am using.
              Attached Files

              Comment


                #8
                Thank you for this update, toptrader. It looks like we have successfully removed the unprintable characters from your code. Since you are still seeing these messages, this means that your compiler is probably adding these characters. We can try to repair your compiler with a complete reinstall.

                Please follow these steps to completely uninstall and reinstall NinjaTrader 8 on your system.


                • Download a fresh copy of NinjaTrader 8 from ninjatrader.com
                • Close NinjaTrader 8
                • Rename your (My) Documents\NinjaTrader 8\db\NinjaTrader.sdf file so it becomes (My) Documents\NinjaTrader 8\db\NinjaTrader.20161122.sdf
                • Rename your (My) Documents\NinjaTrader 8 folder so it becomes (My) Documents\NinjaTrader 8 - 20161122
                • Use the installer you downloaded to uninstall, and then reinstall, NinjaTrader 8
                • Copy these files and folders from your NinjaTrader 8 - 20161122 folder to your NinjaTrader 8 folder, under (My) Documents. If asked to replace files, always select "yes"
                  • Config.xml
                  • UI.xml
                  • workspaces
                  • templates
                  • all .dll files in bin\Custom except these :
                    • NinjaTrader.Custom.dll
                    • NinjaTrader.Vendor.dll

                  • all .cs files in bin\Custom except these :
                    • NinjaTrader.Custom.cs
                    • NinjaTrader.Vendor.cs
                    • AssemblyInfo.cs

                  • any subfolder of bin\Custom that has a .cs file that does not start with an @ sign

                • Start NinjaTrader 8. You will receive some dialogs about Ninja being unable to start because it needed to recompile some dlls. OK out of these dialogs
                • Start NinjaTrader 8 once more
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  I followed your instructions, but I did not receive any dialogs about needing to recompile any dlls. I am still getting the same error after the uninstall and reinstall. Are you seeing the error on your end if you try to run the add on?

                  Comment


                    #10
                    Thank you for your report, and for the updated code.


                    This behavior was confirmed on our end. We will be investigating this further. Please keep an eye on the NinjaTrader 8 Release Notes page for updates and bugfixes.





                    Tracking ID: NTEIGHT-10802
                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      I have an update regarding NTEIGHT-10802. We have encountered a limitation in the underlying C# technology which we will be clearly documenting :
                      1. any class which derives from NTWindow or implements IWorkspacePersistance cannot be a nested class of another class
                      2. any class which derives from NTWindow or implements IWorkspacePersistance must have a default constructor

                      By default constructor, we mean a constructor which takes no arguments. In your code you will see a nested class near line 329. You will need to refactor your code so that this class is in another file, or so its code is part of your outer class.


                      Please let us know if there are any other ways we can help.
                      Jessica P.NinjaTrader Customer Service

                      Comment


                        #12
                        Hello
                        I have absolutely same problem in 8.0.16.2 64-bit today.
                        Does bus still not fixed, of am I just not lucky?
                        fx.practic
                        NinjaTrader Ecosystem Vendor - fx.practic

                        Comment


                          #13
                          Hello fx.practic,

                          NTEIGHT-10802 is not marked as corrected and was not listed in the release notes as corrected. This is marked as expected.

                          To confirm, your addon class is a subclass is this correct?

                          As this was marked as expected, I am happy to submit a feature request to allow classes that implement IWorkspacePersistance to be sub classes if you would like.
                          Chelsea B.NinjaTrader Customer Service

                          Comment


                            #14
                            Hello Chelsea, thank You for the answer.

                            I don't want to implement IWorkspacePersistance, only derive from NTWindow.
                            I move my class outside Indicator class, inside Indicators namespace and it starts work.
                            I was able to make my class private and to use parameters in window constructor.

                            And Yes, please, submit feature to let custom classes, derived from NTWindow and implemented IWorkspacePersistance, to be nested (at least, inside Indicator and Strategy class).

                            I believe this would be a good approach meaning encapsulation ideology.
                            Last edited by fx.practic; 11-06-2018, 03:06 AM.
                            fx.practic
                            NinjaTrader Ecosystem Vendor - fx.practic

                            Comment


                              #15
                              Hello fx.practic,

                              I'm not certain that I am understanding. You are trying to make an Addon that inherits from NTWindow and also have this be in the NinjaScript.Indicator namespace?

                              This is not supported and not advised.

                              Are you trying to open an addon window from a indicator? (I have an example that demonstrates this)
                              Chelsea B.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by arvidvanstaey, Today, 02:19 PM
                              4 responses
                              11 views
                              0 likes
                              Last Post arvidvanstaey  
                              Started by samish18, 04-17-2024, 08:57 AM
                              16 responses
                              61 views
                              0 likes
                              Last Post samish18  
                              Started by jordanq2, Today, 03:10 PM
                              2 responses
                              9 views
                              0 likes
                              Last Post jordanq2  
                              Started by traderqz, Today, 12:06 AM
                              10 responses
                              18 views
                              0 likes
                              Last Post traderqz  
                              Started by algospoke, 04-17-2024, 06:40 PM
                              5 responses
                              48 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X