• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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.

            https://www.screencast.com/t/y7Yy9BMRT

            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.

              https://www.screencast.com/t/y7Yy9BMRT

              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 zweistein, 11-14-2017, 03:24 PM
                  2 responses
                  1,476 views
                  0 likes
                  Last Post woodie1
                  by woodie1
                   
                  Started by Newtrader101, Today, 04:50 AM
                  3 responses
                  18 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by utilizator, Today, 06:31 AM
                  3 responses
                  13 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by digibob, Today, 01:13 AM
                  3 responses
                  14 views
                  0 likes
                  Last Post digibob
                  by digibob
                   
                  Started by calebsandfort, Yesterday, 05:16 PM
                  2 responses
                  11 views
                  0 likes
                  Last Post NinjaTrader_PaulH  
                  Working...
                  X