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

Calling Custom Indicator From Sub-Folder Error

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

    Calling Custom Indicator From Sub-Folder Error

    Dear Support,

    When developing a custom indicator that calls, as part of its calculations, another custom indicator (not supported) located in a sub-folder (i.e. bin/Indicators/MyIndicators) an error is generated that the indicator is a "method" but it is used like a "type"(CS0118)

    However, if the called custom indicator is located under the default bin/Indicators, there is no issue and script will compile fine.

    Perhaps the following example help;

    xxx = MyIndi(Close, Par1); will not compile if MyIndi is under bin/Indicators/MyFolder, but

    xxx = MyIndi(Close, Par1); will compile if MyIndi is located under bin/Indicators

    Do I need to code the location of the called custom indicator? How do I need to include the location (MyFolder) so that it will compile?

    Thanks.

    #2
    Hello aligator,

    Thanks for opening the thread.

    When you move an indicator to a sub folder within the indicator folder, NinjaTrader 7 will no longer include that indicator when compiling the custom assembly.

    I am not aware of any way you could add another path for custom indicators.

    All indicators will have to be included in the bin/Custom/Indicator/ folder if they are to be used on the NinjaTrader 7 platform.

    Please let me know if you have any additional questions.
    JimNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jim View Post
      Hello aligator,

      Thanks for opening the thread.

      When you move an indicator to a sub folder within the indicator folder, NinjaTrader 7 will no longer include that indicator when compiling the custom assembly.

      I am not aware of any way you could add another path for custom indicators.

      All indicators will have to be included in the bin/Custom/Indicator/ folder if they are to be used on the NinjaTrader 7 platform.

      Please let me know if you have any additional questions.
      Thanks Jim,

      I am using and talking about NT8.0.7.0. Sorry that I posted under NT7 section by mistake.
      I don't think creating subfolders are even possible under NT7.
      Last edited by aligator; 06-07-2017, 07:10 AM.

      Comment


        #4
        Hello aligator,

        Thanks for clearing that up.

        When you create a new folder within the NinjaScript Editor, (not from Windows Explorer) and move a NinjaScript to that folder, it creates a new namespace for the NinjaScript based on the folder name.

        When this is done through Windows Explorer, the NinjaScript Editor will not modify the namespace of the NinjaScript so it matches the sub folder it resides in.

        You could update the references from your strategy to include the fully qualified namespace.

        For example:
        Code:
        //This namespace holds Indicators in this folder and is required. Do not change it. 
        namespace NinjaTrader.NinjaScript.Indicators.Folder
        {
            ...
        Would need to be referenced as:
        Code:
        private NinjaTrader.NinjaScript.Indicators.Folder.MyIndicator
        Or you can designate the namespace of the indicator in the subfolder solely as:
        Code:
        NinjaTrader.NinjaScript.Indicators
        Please let me know if I may be of further assistance.
        JimNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Jim View Post
          Hello aligator,

          Thanks for clearing that up.

          When you create a new folder within the NinjaScript Editor, (not from Windows Explorer) and move a NinjaScript to that folder, it creates a new namespace for the NinjaScript based on the folder name.

          When this is done through Windows Explorer, the NinjaScript Editor will not modify the namespace of the NinjaScript so it matches the sub folder it resides in.

          You could update the references from your strategy to include the fully qualified namespace.

          For example:
          Code:
          //This namespace holds Indicators in this folder and is required. Do not change it. 
          namespace NinjaTrader.NinjaScript.Indicators.Folder
          {
              ...
          Would need to be referenced as:
          Code:
          private NinjaTrader.NinjaScript.Indicators.Folder.MyIndicator
          Or you can designate the namespace of the indicator in the subfolder solely as:
          Code:
          NinjaTrader.NinjaScript.Indicators
          Please let me know if I may be of further assistance.
          Thank you Jim,

          That is exactly what I have done. The namespace was edited and compiled as follows:
          Code:
          namespace NinjaTrader.NinjaScript.Indicators.Folder.MyIndicator
          The issue, as explained in Post #1, still remains. Perhaps you could re-create the issue.

          Thanks.
          Last edited by aligator; 06-07-2017, 07:53 PM.

          Comment


            #6
            Hello aligator,

            Thanks for the reply.

            Have you made the changes to the calling NinjaScript?

            I've created a video demonstrating how I've created a new folder, moved an indicator to that new folder, and changed the calling NinjaScript to include the fully qualified namespace.

            Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


            Please let me know if I can be of further help.
            JimNinjaTrader Customer Service

            Comment


              #7
              Originally posted by NinjaTrader_Jim View Post
              Hello aligator,

              Thanks for the reply.

              Have you made the changes to the calling NinjaScript?

              I've created a video demonstrating how I've created a new folder, moved an indicator to that new folder, and changed the calling NinjaScript to include the fully qualified namespace.

              Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


              Please let me know if I can be of further help.
              Thank you Jim.
              Last edited by aligator; 06-08-2017, 10:34 AM.

              Comment


                #8
                Hello aligator,

                Thanks for writing back.

                I think I will need an example to see how you are setting up an enum list of indicators and are encountering this error to be able to assist you further. Could you provide an example of a placeholder indicator that resides in a separate namespace and another indicator that has it added to an enum as you describe?

                Before creating a test case, could you make sure that you cannot get around this matter by adding the owning namespace to the other using directives? For example, if I my indicator resides in NinjaTrader.NinjaScript.Indicators.Folder, I could use the syntax below so the hosting NinjaScript knows where the to find the indicator.

                Code:
                using NinjaTrader.NinjaScript.Indicators.Folder;
                I look forward to assisting further.
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by NinjaTrader_Jim View Post
                  Hello aligator,

                  Thanks for writing back.

                  I think I will need an example to see how you are setting up an enum list of indicators and are encountering this error to be able to assist you further. Could you provide an example of a placeholder indicator that resides in a separate namespace and another indicator that has it added to an enum as you describe?

                  Before creating a test case, could you make sure that you cannot get around this matter by adding the owning namespace to the other using directives? For example, if I my indicator resides in NinjaTrader.NinjaScript.Indicators.Folder, I could use the syntax below so the hosting NinjaScript knows where the to find the indicator.

                  Code:
                  using NinjaTrader.NinjaScript.Indicators.Folder;
                  I look forward to assisting further.
                  Thank you Jim,

                  The issue is resolved. I was using the following:

                  Code:
                  private MyIndicator    myIndicator
                  After seeing your comment and code in your post, I realized I needed to reference the subfolder that I have already included in the namespace. So I changed that one line to:

                  Code:
                   private  MyFolder.MyIndicator  myIndicator
                  and everything worked fine.

                  Thank you so much for staying with me and I really appreciate that.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by adeelshahzad, Today, 03:54 AM
                  5 responses
                  32 views
                  0 likes
                  Last Post NinjaTrader_BrandonH  
                  Started by stafe, 04-15-2024, 08:34 PM
                  7 responses
                  31 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Started by merzo, 06-25-2023, 02:19 AM
                  10 responses
                  823 views
                  1 like
                  Last Post NinjaTrader_ChristopherJ  
                  Started by frankthearm, Today, 09:08 AM
                  5 responses
                  19 views
                  0 likes
                  Last Post NinjaTrader_Clayton  
                  Started by jeronymite, 04-12-2024, 04:26 PM
                  3 responses
                  43 views
                  0 likes
                  Last Post jeronymite  
                  Working...
                  X