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

CS0246: The namespace could not be found while exporting of the working indicator.

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

    CS0246: The namespace could not be found while exporting of the working indicator.

    Hi!
    I am using the custom DLL in my indicator.
    On the chart this indicator is working as expected.
    After updating to the version 8.0.24.2 64-bit the error "error CS0246: The type or namespace name 'LicenseSpot' could not be found (are you missing a using directive or an assembly reference?)" appears when I try to export the assembly either as a source or as a compiled.

    Before updating to the current version everything worked as expected.

    How to export the working indicator, please?

    Regards,


    #2
    Hello AlexMocc,

    Thank you for the post.

    This could relate to how the "LicenseSpot" was coded or also how it has been used in your code.

    Is LicenseSpot a custom class or is that an indicator/strategy? Also how was that used in your code?

    If that is a custom class or other type which is not a NinjaScript native type like indicator/strategy it may be that you need to use the fully qualified namespace when calling that. This error generally would occur during an export for types like an enum, if you are using "using" statements at the top of the script instead of the full namespace where you call the type in your code.

    If you have a small example of the code being used/structure we can likely provide more specific details or find a solution.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I was able to export this indicator in the previous version of NT8. The source code of the indicator and dll is the same.
      No any errors is appearing while I am compiling the indicator in the editor.
      Attached Files

      Comment


        #4
        Hello AlexMocc,

        You can try removing the using statement and instead hard code the namespace where you used the dll. Unfortunately I cannot comment about the dll as that code is not visible. If you have the source code for that we could try reviewing that. I otherwise had to delete that sample as dll's are not allowed on the forums.

        Code:
        using LicenseSpot.Framework;
        LicenseSpot.Framework.ExtendedLicense license = null
        to
        Code:
        LicenseSpot.Framework.LicenseSpot.Framework.ExtendedLicense license = null;
        That may or may not be correct, I am only taking the namespace and appending it to the variable you had, you will need to review what the fully qualified namespace is for that type.

        Are you also manually including the Reference in the export screen by selecting the dropdown -> references and adding the LicenseSpot dll?

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Is the indicator compiled without errors?
          I have used different variant with the manespaces.The result is the same.
          It looks there is a bug introduced into the version 8.0.24.2 64-bit

          Comment


            #6
            It looks like I have missed the dll in my post

            Comment


              #7
              Just try to export this indicator, please.
              "Are you also manually including the Reference in the export screen by selecting the dropdown -> references and adding the LicenseSpot dll?"

              Sure.

              The indicator is working as expected on the chart.
              Last edited by AlexMocc; 05-14-2021, 08:05 AM.

              Comment


                #8
                It is the working indicator.
                Attached Files

                Comment


                  #9
                  Hello AlexMocc,

                  I had to remove your post, dlls are not allowed to be uploaded so please don't include the dll as an attachment. We won't be able to review the code in the dll and we cannot import a foreign dll for safety reasons.

                  Is the indicator compiled without errors?
                  I cannot import this item to test it due to the complexity and dependency of the dll. If you have the source code for the dll so that I can export the source as a DLL on my end I could try that. I would otherwise suggest to make a more simple test on your end to see what specifically is required to see the error during the export.

                  Do you see the problem if you reference the dll and only use a type from that dll in a new empty indicator? For example using only this line, again removing the "using" statement and fully qualifying the type:
                  Code:
                  LicenseSpot.Framework.ExtendedLicense license = null;
                  It looks there is a bug introduced into the version 8.0.24.2 64-bit
                  I could not confirm that as we don't know what is contained in the dll or how that was coded. The problem likely relates to how you are using the dll or how the dll is coded. You would need to do some testing to find what specific syntax is required to see the export fail and then we could work with those details. We would need a sample of the code from the dll which is being used and failing to export in combination with a sample of the code used in the indicator that fails to export. The dll will not help to move through the problem as we cannot see the code or import that.


                  The indicator is working as expected on the chart.
                  This really has nothing to do with the export process. Indicators will work as source code on a chart, the export is going to compile the file into a dll. If there is a syntax problem in the file or in the DLL you are using that may cause the export to fail while the indicator still works locally.


                  I look forward to being of further assistance.
                  JesseNinjaTrader Customer Service

                  Comment


                    #10
                    All your recommendations do not help.
                    The situation is really annoying.
                    I can grant you an access to my computer to check whatever you want.
                    What is the way to send you TV credentials?
                    Last edited by AlexMocc; 05-14-2021, 08:25 AM.

                    Comment


                      #11
                      As you see the indicator is working on the chart. The export does not work.
                      It means it is the issue with NT8.
                      Attached Files

                      Comment


                        #12
                        Hello AlexMocc,

                        We cannot provide remote assistance for custom coding issues. We can work through the problem here however you will need to extract the code thats failing to export and provide that.

                        We would need a sample of the indicator code that is failing to export along with the code used in the DLL which is causing the failure.

                        Again the indicator working in the chart does not help, that detail is not going to be relevant to the export process.

                        I would suggest reducing the indicator to the most simple example by using a single type from the dll. Then extract the code you are referencing in the dll as source code and include those two items.

                        We would need to be able to export the code used in the DLL from our end so we know what code is being affected. After doing that we could try exporting the indicator which is failing. Without being able to do that all I can suggest is that you reduce what you are doing to find the code required to see the issue. We cannot import the dll as is to test it because that won't be helpful in finding the problem, we need to see the code used in the dll to understand why the export may be failing.

                        Please let me know if I may be of further assistance.
                        JesseNinjaTrader Customer Service

                        Comment


                          #13
                          This is the minimal indicator.
                          I have no source of the dll. You can find it on this site https://www.licensespot.com/
                          The minimal indicator is working. But I cannot still export it for some reason.
                          Attached Files

                          Comment


                            #14
                            Hello AlexMocc,

                            I see that you have not tried using a fully qualified name, you are using:
                            Code:
                             using LicenseSpot.Framework;
                            That would be incorrect for any custom type, you need to delete that line which will cause a compile error. After that you would need to correct any errors by directly using the namespace in the code you use in OnBarUpdate.

                            Please see the enum example here and how the full namespace is being used and not a using statement: https://ninjatrader.com/support/help...ned_parame.htm

                            Do you still see the problem when not using the using statement at the top of the file and instead using fully qualified types?

                            The only other suggestion that I could make here is to make sure you have the dll placed in the Documents\NinjaTrader 8\bin\Custom folder, if it resides outside of that folder or in a sub folder it would not be expected to work correctly.

                            The dll otherwise hides the code so there would not be a way to see why that may be failing to export when used in NinjaScript.


                            Please let me know if I may be of further assistance.
                            JesseNinjaTrader Customer Service

                            Comment


                              #15
                              Witch .NET is required to export the indicator?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by aussugardefender, Today, 01:07 AM
                              0 responses
                              3 views
                              0 likes
                              Last Post aussugardefender  
                              Started by pvincent, 06-23-2022, 12:53 PM
                              14 responses
                              238 views
                              0 likes
                              Last Post Nyman
                              by Nyman
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              9 responses
                              383 views
                              1 like
                              Last Post Gavini
                              by Gavini
                               
                              Started by oviejo, Today, 12:28 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post oviejo
                              by oviejo
                               
                              Started by pechtri, 06-22-2023, 02:31 AM
                              10 responses
                              125 views
                              0 likes
                              Last Post Leeroy_Jenkins  
                              Working...
                              X