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

  • aligator
    replied
    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.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    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.

    Leave a comment:


  • aligator
    replied
    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.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    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.

    Leave a comment:


  • aligator
    replied
    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.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    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.

    Leave a comment:


  • aligator
    replied
    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.

    Leave a comment:


  • NinjaTrader_Jim
    replied
    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.

    Leave a comment:


  • aligator
    started a topic Calling Custom Indicator From Sub-Folder Error

    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.

Latest Posts

Collapse

Topics Statistics Last Post
Started by pechtri, 06-22-2023, 02:31 AM
9 responses
122 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by frankthearm, 04-18-2024, 09:08 AM
16 responses
66 views
0 likes
Last Post NinjaTrader_Clayton  
Started by habeebft, Today, 01:18 PM
1 response
5 views
0 likes
Last Post NinjaTrader_ChelseaB  
Started by benmarkal, Today, 12:52 PM
2 responses
13 views
0 likes
Last Post benmarkal  
Started by f.saeidi, Today, 01:38 PM
1 response
7 views
0 likes
Last Post NinjaTrader_BrandonH  
Working...
X