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

Creating a Utilities folder

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

  • NinjaTrader_Jim
    replied
    Hello RandyT,

    Thanks for your post.

    We typically advise to create shared methods in a separate file and then to create partial classes for your indicator or strategy based shared methods. You may also add code to the AddOn namespace or your own namespace as well. The NinjaScript that calls these methods will then need to reference the shared methods with the fully qualified namespace or add a using directive for that namespace to find the methods.

    For example, code within:

    Code:
    namespace NinjaTrader.NinjaScript.AddOns.MySharedMethods
    {
    	public void MyMethod()
    	{}
    Will have to be referenced like:

    Code:
    NinjaTrader.NinjaScript.AddOns.MySharedMethods.MyMethod();
    or

    Code:
    using NinjaTrader.NinjaScript.AddOnsMySharedMethods;
    
    ...
    
    MyMethod();
    Creating a new folder does not create a new namespace, this will have to be added to the script.

    An example for shared methods that we have shared previously can be found below.

    Shared Methods example: https://ninjatrader.com/support/foru...104#post457104

    Please let us know if you have any additional questions.

    Leave a comment:


  • RandyT
    started a topic Creating a Utilities folder

    Creating a Utilities folder

    I have a number of shared Functions or Methods that I use in a number of different indicators and strategies. I was hoping that adding a folder into the Class hierarchy would be as easy as creating that folder. But alas...

    Could someone guide me toward how to create this setup?

    Would be a useful thing if NT did this by default.

Latest Posts

Collapse

Topics Statistics Last Post
Started by kujista, Today, 06:23 AM
0 responses
1 view
0 likes
Last Post kujista
by kujista
 
Started by traderqz, Yesterday, 04:32 PM
1 response
12 views
0 likes
Last Post NinjaTrader_Gaby  
Started by f.saeidi, Today, 05:56 AM
1 response
5 views
0 likes
Last Post Jltarrau  
Started by Jltarrau, Today, 05:57 AM
0 responses
5 views
0 likes
Last Post Jltarrau  
Started by Stanfillirenfro, Yesterday, 09:19 AM
7 responses
53 views
0 likes
Last Post NinjaTrader_Gaby  
Working...
X